From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Utkarsh Singh Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add switches for Git log command Date: Mon, 07 Jun 2021 09:47:40 +0530 Message-ID: <871r9eqpej.fsf@gmail.com> References: <87k0nej78o.fsf@gmail.com> <7ddd9a69-d1ff-132f-66ed-a9b5526d2ce7@yandex.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36970"; mail-complaints-to="usenet@ciao.gmane.io" To: Dmitry Gutov , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 07 06:18:19 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lq6iQ-0009PV-T6 for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Jun 2021 06:18:19 +0200 Original-Received: from localhost ([::1]:43344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lq6iP-00082u-Bw for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Jun 2021 00:18:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lq6he-0007Nq-Ln for emacs-devel@gnu.org; Mon, 07 Jun 2021 00:17:30 -0400 Original-Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:41950) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lq6hc-0001qp-U5 for emacs-devel@gnu.org; Mon, 07 Jun 2021 00:17:30 -0400 Original-Received: by mail-pl1-x635.google.com with SMTP id o12so4539167plk.8 for ; Sun, 06 Jun 2021 21:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=GIUMHAaK08GMwk+Txth/QwwWvDR9JTjMWEMoZmzMiGo=; b=qURNJTeQEjwZxTTlRs61S2S/sgcIKeA9j9Fp+2HrdvpvXWbjVB7MbLx5AYN/NVO8hZ c7DTNeI+XOp6U16cgU35b5AikDCmmySC1gIirKCRm2f/hPB5iTLbRQL8Ewqx7Etk7MQa YcuGQ6rn2Io/xsWXHnp4aE/s6yshSwTmkSwbSbTp8XADeVXctJiTS6noHWRKtxZS1RUg UUsdC9p9cYKa4ym1y32JcqezIft6BeMOOt+u3jTEDLYBt2225429FHJTXPv7biDdFu/t 1tB3z8Ij0SVS+Q10Lu2/jknGIwrWlf/0S1DBpCMhds97Tx7zilJmrZrxfya8uUP7sQwZ aLtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=GIUMHAaK08GMwk+Txth/QwwWvDR9JTjMWEMoZmzMiGo=; b=KI5uwYiVuiOZQbc5S2n+nnMEyN5tewej0LMYYggmbNiiaPzXoCar2KseqCkmXLAWJ4 jmZr28sJGSsa06GtVjgvYX9gWXwtephYpe6A/OUb6D92MDRWxsaol7mRT9ZTD8QxFIQx FbCIehHCtE3LMH7oplSgfvE7WHrKnEak8sZyV9QesDdff6LvuqDBEY+iooyiWn95DlWr SUQNWryCnMJ0dmzQAn1afSAjwMF24PaiB+m4uhal2nQ9bolOi2KVh3mqIV4QjXj6yuUl EIyPCXrjgndWkmjuAwsDKLzgWAYZDtY+ePAlsKuGeqU8etklqjgY2ubsnQGPdxEmVoHo zRsA== X-Gm-Message-State: AOAM533sAyDu2aYVY+cuJGeBrj87zJPVOTfBnk8qoWVNKMk+sMDX0tLV b91fxWlgTo8PeRMGnfnvkJE= X-Google-Smtp-Source: ABdhPJzA8pRH8H4ToThEKtfF4zy3twJwGIO9w6rD0LB23KjFv0BW7gVBBqrsv5gVtWQ1lxaInnjNLQ== X-Received: by 2002:a17:902:9001:b029:ee:f24a:7e7d with SMTP id a1-20020a1709029001b02900eef24a7e7dmr16109232plp.42.1623039446826; Sun, 06 Jun 2021 21:17:26 -0700 (PDT) Original-Received: from localhost ([103.77.0.113]) by smtp.gmail.com with ESMTPSA id b16sm10921575pju.35.2021.06.06.21.17.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Jun 2021 21:17:26 -0700 (PDT) In-Reply-To: <7ddd9a69-d1ff-132f-66ed-a9b5526d2ce7@yandex.ru> Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=utkarsh190601@gmail.com; helo=mail-pl1-x635.google.com X-Spam_score_int: 1 X-Spam_score: 0.1 X-Spam_bar: / X-Spam_report: (0.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_OTHER_BAD_TLD=1.997, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:270517 Archived-At: --=-=-= Content-Type: text/plain On 2021-06-07, 03:00 +0300, Dmitry Gutov wrote: > On 01.06.2021 11:53, Utkarsh Singh wrote: >> VC provides `vc-print-log' command to view changes in current fileset >> which displays hash, author, date and commit message. By default git >> displays date in format 'Mon May 31 07:29:51 2021 +0200' but I wanted >> '2021-05-31 07:29:51 +0200' which is supported by '--date=iso' switch. >> >> Currently `vc-print-log' provides no option to tweak it's behaviour with >> switches hence I am proposing a patch which introduces a variable >> `vc-git-log-switches' to provide the necessary functionally. > > I'm good with this. Thank you for accepting my feature request. > Could you resend the change as attachment, preferably with a commit > message written to our standard? 'git format-patch' can help. Yes! -- Utkarsh Singh http://utkarshsingh.xyz --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-New-user-option-for-Git-log-switches.patch Content-Description: patch >From e84cf00a367bded4489cd8defbcb36a5913d3f96 Mon Sep 17 00:00:00 2001 From: Utkarsh Singh Date: Tue, 1 Jun 2021 14:33:01 +0530 Subject: [PATCH] New user option for Git log switches * lisp/vc/vc-git.el (vc-git-print-log): New defcustom `vc-git-diff-switches'. * etc/NEWS: Announce the new option. --- etc/NEWS | 4 ++++ lisp/vc/vc-git.el | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 6622861aaf..db4fc3e7fb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -829,6 +829,10 @@ If non-nil, only branches and remotes are considered when doing completion over Git branch names. The default is nil, which causes tags to be considered as well. +--- +*** New user option 'vc-git-log-switches'. +Strings or list of strings specifying switches for Git log under VC. + ** Gnus +++ diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index e37c09df7c..402685ad1c 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -118,6 +118,12 @@ vc-git-diff-switches (repeat :tag "Argument List" :value ("") string)) :version "23.1") +(defcustom vc-git-log-switches t + "Strings or list of strings specifying switches for Git log under VC." + :type '(choice (const :tag "None" t) + (string :tag "Argument String") + (repeat :tag "Argument List" :value ("") string))) + (defcustom vc-git-annotate-switches nil "String or list of strings specifying switches for Git blame under VC. If nil, use the value of `vc-annotate-switches'. If t, use no switches." @@ -1131,6 +1137,8 @@ vc-git-print-log-follow :type 'boolean :version "26.1") +(autoload 'vc-switches "vc") + (defun vc-git-print-log (files buffer &optional shortlog start-revision limit) "Print commit log associated with FILES into specified BUFFER. If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'. @@ -1164,6 +1172,7 @@ vc-git-print-log ,(format "--pretty=tformat:%s" (car vc-git-root-log-format)) "--abbrev-commit")) + (vc-switches 'git 'log) (when (numberp limit) (list "-n" (format "%s" limit))) (when start-revision @@ -1385,8 +1394,6 @@ vc-git--asciify-coding-system samp coding-system-for-read t))) (setq coding-system-for-read 'undecided))) -(autoload 'vc-switches "vc") - (defun vc-git-diff (files &optional rev1 rev2 buffer _async) "Get a difference report using Git between two revisions of FILES." (let (process-file-side-effects -- 2.31.1 --=-=-=--