GNU bug report logs - #21120
vc-chlog fails if git submodules are dirty

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: vc-dwim; Reported by: Assaf Gordon <assafgordon@HIDDEN>; dated Thu, 23 Jul 2015 00:11:02 UTC; Maintainer for vc-dwim is bug-vc-dwim@HIDDEN.

Message received at 21120 <at> debbugs.gnu.org:


Received: (at 21120) by debbugs.gnu.org; 30 Jul 2015 16:09:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 30 12:09:10 2015
Received: from localhost ([127.0.0.1]:34939 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZKqOL-0004b6-Vy
	for submit <at> debbugs.gnu.org; Thu, 30 Jul 2015 12:09:10 -0400
Received: from mail-io0-f196.google.com ([209.85.223.196]:34089)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <meyering@HIDDEN>) id 1ZKqOJ-0004av-MB
 for 21120 <at> debbugs.gnu.org; Thu, 30 Jul 2015 12:09:08 -0400
Received: by iojj196 with SMTP id j196so4312678ioj.1
 for <21120 <at> debbugs.gnu.org>; Thu, 30 Jul 2015 09:09:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:in-reply-to:references:from:date:message-id
 :subject:to:cc:content-type;
 bh=UbIQqx4X+J9k3S4br/vo68gFoEgg44L81xS3k0aRsmY=;
 b=jU4+Qlrlpof9Z7c8uOfedt1GmpiuwFiwlhy5VuL2abh8z9Hbf2kyw1dlCMz4Mpf42g
 6RHgcncurb/j0zvoZWgfkEplXWBPsAvBe59qlq4+o6upl4a3uhWThCw7AQbzBOYfDwIU
 zh/tLTS3YHSrKfEqGFe7yelHbohuekkNNb7l83Ql+I6Se2dG0bK2U0xJWTj8dA4hVYu+
 SW/vuzyXNPxIL5XwdddSF71mhX1ccuiCfZAVhFgGsSskZk+p7zpjCONZDRChVqbnIhbQ
 chvWosW10R6JExsOFqqwukTqobscJjN4z3knWTLOmILKex2s8JvTB6cES/yZp2iAwv+r
 SZQg==
X-Received: by 10.107.168.222 with SMTP id e91mr4347059ioj.181.1438272546976; 
 Thu, 30 Jul 2015 09:09:06 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.36.10.72 with HTTP; Thu, 30 Jul 2015 09:08:47 -0700 (PDT)
In-Reply-To: <20150729234401.GB6640@HIDDEN>
References: <55B02D47.5060203@HIDDEN>
 <CA+8g5KGjCtDmhB8QmAAO6x2=ixNRJxY7S_V9UbRimYmub0bM6A@HIDDEN>
 <20150729234401.GB6640@HIDDEN>
From: Jim Meyering <jim@HIDDEN>
Date: Thu, 30 Jul 2015 09:08:47 -0700
X-Google-Sender-Auth: umBRzOSKtvdKsz79bu71LMssttE
Message-ID: <CA+8g5KEmfup0GbDBLixXoPxXT_M3MSM4F40LHebNzMFkhpTo3A@HIDDEN>
Subject: Re: [Bug-vc-dwim] bug#21120: vc-chlog fails if git submodules are
 dirty
To: Assaf Gordon <assafgordon@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 21120
Cc: 21120 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

On Wed, Jul 29, 2015 at 4:44 PM, Assaf Gordon <assafgordon@HIDDEN> wrote:
> Hello,
>
> On Mon, Jul 27, 2015 at 10:22:08PM -0700, Jim Meyering wrote:
>>
>> On Wed, Jul 22, 2015 at 4:54 PM, Assaf Gordon <assafgordon@HIDDEN>
>> wrote:
>>>
>>> it seems that if a project using git has a submodule that is dirty,
>>> vc-chlog
>>> will fail to print the information about all the files.
>
> <...>
>
>>> Another possible thing is to make 'vc-dwim' abort if there are dirty
>>> submodules, on the assumption that 'vc-dwim' is meant to prevent
>>> problematic
>>> commits, and a dirty submodule is a hint of a potential problem.
>
>
>> Issuing a warning does have a little more appeal to me, but I would be
>> happy
>> with a complete patch implementing either behavior (i.e., updating NEWS
>> and adding a test).
>
> For starters, attached is the simpler approach of silently ignoring dirty
> git submodules with `vc-dwim --diff`.

Very nice work. A perfect patch :-)
Pushed verbatim.
Thank you!




Information forwarded to bug-vc-dwim@HIDDEN:
bug#21120; Package vc-dwim. Full text available.

Message received at 21120 <at> debbugs.gnu.org:


Received: (at 21120) by debbugs.gnu.org; 29 Jul 2015 23:44:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 29 19:44:36 2015
Received: from localhost ([127.0.0.1]:33994 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZKb1Y-0006pa-8z
	for submit <at> debbugs.gnu.org; Wed, 29 Jul 2015 19:44:36 -0400
Received: from mail-qk0-f181.google.com ([209.85.220.181]:36002)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <assafgordon@HIDDEN>) id 1ZKb1W-0006pS-CY
 for 21120 <at> debbugs.gnu.org; Wed, 29 Jul 2015 19:44:35 -0400
Received: by qkdv3 with SMTP id v3so12651331qkd.3
 for <21120 <at> debbugs.gnu.org>; Wed, 29 Jul 2015 16:44:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-type:content-disposition:in-reply-to:user-agent;
 bh=gQqsh+fuyYsaQDRycNCD5rPpqUbkk5cXSo71VGuwCYU=;
 b=CKiWYkpV9SSPFejql+5o2SXmtki/KOILgz2ybtmWG4HKCyylUNCUgCy7b0lwMIGo4J
 3m8/MOWT1SMGe4shf6unP9BiQV1AuSgSvPr+Ao80RGstXb1DmCBLFkQWJtX1GSc7IQPl
 GaY2wmW07qxm0JfClDpmq5DqyOaZ9T9jurPRpRE6QKIUNJt+asrdMK9WICYf90Ga+hfu
 liTECL6qNCo4g8xNgJqypLoIWcUiTVi399Qtf8Jx0SBeU55Y4hi2TuD8a9+kxGDtzuvA
 j4xIP50/t8cvv03IVZAusSVNqbpxlXERk3vUD+fNO8JOA9Fw08tVmeckcJNwuqP9KkIH
 qOTA==
X-Received: by 10.55.21.205 with SMTP id 74mr65822088qkv.19.1438213473855;
 Wed, 29 Jul 2015 16:44:33 -0700 (PDT)
Received: from gmail.com (housegordon.org. [104.236.108.240])
 by smtp.gmail.com with ESMTPSA id 99sm14902914qku.20.2015.07.29.16.44.33
 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
 Wed, 29 Jul 2015 16:44:33 -0700 (PDT)
Date: Wed, 29 Jul 2015 23:44:02 +0000
From: Assaf Gordon <assafgordon@HIDDEN>
To: Jim Meyering <jim@HIDDEN>
Subject: Re: [Bug-vc-dwim] bug#21120: vc-chlog fails if git submodules are
 dirty
Message-ID: <20150729234401.GB6640@HIDDEN>
References: <55B02D47.5060203@HIDDEN>
 <CA+8g5KGjCtDmhB8QmAAO6x2=ixNRJxY7S_V9UbRimYmub0bM6A@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="FCuugMFkClbJLl1L"
Content-Disposition: inline
In-Reply-To: <CA+8g5KGjCtDmhB8QmAAO6x2=ixNRJxY7S_V9UbRimYmub0bM6A@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 21120
Cc: 21120 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)


--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Disposition: inline

Hello,

On Mon, Jul 27, 2015 at 10:22:08PM -0700, Jim Meyering wrote:
>On Wed, Jul 22, 2015 at 4:54 PM, Assaf Gordon <assafgordon@HIDDEN> wrote:
>> it seems that if a project using git has a submodule that is dirty, vc-chlog
>> will fail to print the information about all the files.
<...>

>> Another possible thing is to make 'vc-dwim' abort if there are dirty
>> submodules, on the assumption that 'vc-dwim' is meant to prevent problematic
>> commits, and a dirty submodule is a hint of a potential problem.

>Issuing a warning does have a little more appeal to me, but I would be happy
>with a complete patch implementing either behavior (i.e., updating NEWS
>and adding a test).

For starters, attached is the simpler approach of silently ignoring 
dirty git submodules with `vc-dwim --diff`.

Comments welcomed,
  -assaf

--FCuugMFkClbJLl1L
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="vc-dwim-ignore-git-submodules.patch"

From a4e3c56b2a8e546e8d5d7243b83a5718cac3ad24 Mon Sep 17 00:00:00 2001
From: Assaf Gordon <assafgordon@HIDDEN>
Date: Wed, 29 Jul 2015 19:31:52 -0400
Subject: [PATCH] vc-dwim: silently ignore dirty git submodules

* NEWS: mention it.
* VC.pm: ignore git submodules.
* tests/ignore-dirty-submodules: new file.
* tests/Makefile.am (TESTS): add it.
Discussed in http://bugs.gnu.org/21120
---
 NEWS                          |  2 ++
 VC.pm                         |  5 ++--
 tests/Makefile.am             |  3 ++-
 tests/ignore-dirty-submodules | 55 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 62 insertions(+), 3 deletions(-)
 create mode 100755 tests/ignore-dirty-submodules

diff --git a/NEWS b/NEWS
index 5129e3e..e7cb290 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ vc-dwim NEWS                                          -*- outline -*-
 
   vc-dwim now supports darcs.
 
+  vc-dwim now silently ignores dirty git submodules
+
 
 * Noteworthy changes in release 1.7 (2013-03-15) [stable]
 
diff --git a/VC.pm b/VC.pm
index 81a2390..039f312 100644
--- a/VC.pm
+++ b/VC.pm
@@ -57,8 +57,9 @@ my $vc_cmd =
    GIT() =>
    {
     AUTHOR_FMT => '--author=%s',
-    DIFF_COMMAND => [qw(git diff -B -C HEAD --)],
-    DIFF_PRISTINE => [qw(git diff --no-ext-diff -B -C HEAD --)],
+    DIFF_COMMAND => [qw(git diff --ignore-submodules=all -B -C HEAD --)],
+    DIFF_PRISTINE => [qw(git diff --ignore-submodules=all --no-ext-diff
+                         -B -C HEAD --)],
     VALID_DIFF_EXIT_STATUS => {0 => 1},
     COMMIT_COMMAND => [qw(git commit -q -F)],
     # is-version-controlled-file: true, if "git cat-file -t HEAD:$file"
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 52671b5..2ff6375 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -28,6 +28,7 @@ TESTS = \
   subdir-cvs \
   t-vc-chlog \
   multiple-chlogs \
-  dirty-workdir
+  dirty-workdir \
+  ignore-dirty-submodules
 
 include $(srcdir)/check.mk
diff --git a/tests/ignore-dirty-submodules b/tests/ignore-dirty-submodules
new file mode 100755
index 0000000..c2bc52d
--- /dev/null
+++ b/tests/ignore-dirty-submodules
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Ensure dirty git submodules are ignored by 'vc-dwim --diff'
+
+. "${srcdir=.}/init.sh"; path_prepend_ ..
+print_ver_ vc-dwim
+
+require_git_
+
+fail=0
+
+##
+## Create two git repositories (a,b),
+## add 'a' as submodule of 'b',
+## then modify 'a'.
+##
+mkdir a b || framework_failure_
+(cd a \
+    && git init \
+    && echo a > a \
+    && git add a \
+    && git commit -m a ) >/dev/null || framework_failure_
+(cd b \
+    && git init \
+    && echo b > b \
+    && git add b \
+    && git commit -m b ) >/dev/null || framework_failure_
+(cd b \
+    && git submodule add ../a \
+    && git commit -m "submodule added") >/dev/null || framework_failure_
+
+## Sanity check: ensure no diffs, either with git or with vc-dwim
+cd b
+A=$(git diff) || framework_failure_
+test -z "$A" || framework_failure_
+B=$(vc-dwim --diff) || framework_failure_
+test -z "$B" || framework_failure_
+
+## Modify the submodule
+echo >> a/a || framework_failure_
+
+## git diff should report a dirty submodule
+git diff | grep -q '^\+Subproject commit [0-9a-f]*-dirty$' \
+    || framework_failure_
+
+## git diff with ignore flag should not report anything
+## (if this doesn't work as expected, vc-dwim will fail too)
+C=$(git diff --ignore-submodules=all) || framework_failure_
+test -z "$C" || framework_failure_
+
+## Now test vc-dwim
+D=$(vc-dwim --diff) || framework_failure_
+test -z "$D" || fail=1
+
+Exit $fail
-- 
1.9.1


--FCuugMFkClbJLl1L--




Information forwarded to bug-vc-dwim@HIDDEN:
bug#21120; Package vc-dwim. Full text available.

Message received at 21120 <at> debbugs.gnu.org:


Received: (at 21120) by debbugs.gnu.org; 28 Jul 2015 05:22:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 28 01:22:31 2015
Received: from localhost ([127.0.0.1]:60622 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZJxLS-0007B9-8f
	for submit <at> debbugs.gnu.org; Tue, 28 Jul 2015 01:22:30 -0400
Received: from mail-ig0-f175.google.com ([209.85.213.175]:34712)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <meyering@HIDDEN>) id 1ZJxLP-0007B1-VK
 for 21120 <at> debbugs.gnu.org; Tue, 28 Jul 2015 01:22:28 -0400
Received: by igk11 with SMTP id 11so91867221igk.1
 for <21120 <at> debbugs.gnu.org>; Mon, 27 Jul 2015 22:22:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:sender:in-reply-to:references:from:date:message-id
 :subject:to:cc:content-type;
 bh=jVtjOwZPwxyF/I9AZNSFRry60tFrrunIJ3o+zx7cmTc=;
 b=TEgKhkJySbh2MWbbUNsuj9KfrvlE+1kLZF9hV9EsqB9ojwBtoRDY+wBKogxOareVtz
 FG45Enxds/P05YxnRMRc/mLUNCrozf00fRNcPzOK4sSQJv1KIjg8d9ZBtkQUyj4GixbG
 7Y85b+vDxFoHhCA31RH827i3CEVtvOe9qcA7e8nO2C8H6XLb662crdj5n4nm6CZNF36N
 SqHCF2Hbp60aS9INNMXbul4r+Z41H2cZFnCgVZlldPZSwB2GCF+OHBwgt1RcrxIfTsEx
 VqsFY5tqha0ZV7hPA7o03CbGY+blwPmPUf8twXRSIABiJ2/37aBAKmnNkooTxQ1MrZVM
 K/qw==
X-Received: by 10.107.26.203 with SMTP id a194mr47379909ioa.62.1438060947378; 
 Mon, 27 Jul 2015 22:22:27 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.36.10.72 with HTTP; Mon, 27 Jul 2015 22:22:08 -0700 (PDT)
In-Reply-To: <55B02D47.5060203@HIDDEN>
References: <55B02D47.5060203@HIDDEN>
From: Jim Meyering <jim@HIDDEN>
Date: Mon, 27 Jul 2015 22:22:08 -0700
X-Google-Sender-Auth: glpfBQxk1x4XXO2KKie2IW632sw
Message-ID: <CA+8g5KGjCtDmhB8QmAAO6x2=ixNRJxY7S_V9UbRimYmub0bM6A@HIDDEN>
Subject: Re: [Bug-vc-dwim] bug#21120: vc-chlog fails if git submodules are
 dirty
To: Assaf Gordon <assafgordon@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 21120
Cc: 21120 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

On Wed, Jul 22, 2015 at 4:54 PM, Assaf Gordon <assafgordon@HIDDEN> wrote:
> Hello,
>
> it seems that if a project using git has a submodule that is dirty, vc-chlog
> will fail to print the information about all the files.
>
> To reproduce:
> ====
>    git clone git://git.sv.gnu.org/hello.git
>    cd hello/
>    ./bootstrap
>    echo >> bootstrap.conf
>    echo >> gnulib/cfg.mk
>    echo >> src/hello.c
> ====
>
> The diff looks like this:
> ===
> $ git diff
> diff --git a/bootstrap.conf b/bootstrap.conf
> index 9e6b005..79d4c5b 100644
> --- a/bootstrap.conf
> +++ b/bootstrap.conf
> @@ -119,3 +119,4 @@ bootstrap_epilogue()
>      done
>    fi
>  }
> +
> diff --git a/gnulib b/gnulib
> --- a/gnulib
> +++ b/gnulib
> @@ -1 +1 @@
> -Subproject commit b9bfe78424b871f5b92e5ee9e7d21ef951a6801d
> +Subproject commit b9bfe78424b871f5b92e5ee9e7d21ef951a6801d-dirty
> diff --git a/src/hello.c b/src/hello.c
> index 8e6cfbd..f0d12de 100644
> --- a/src/hello.c
> +++ b/src/hello.c
> @@ -187,3 +187,4 @@ License GPLv3+: GNU GPL version 3 or later
> <http://gnu.org/licenses/gpl.html>\n\
>  This is free software: you are free to change and redistribute it.\n\
>  There is NO WARRANTY, to the extent permitted by law.\n"), COPYRIGHT_YEAR);
>  }
> +
> ===
>
> But vc-chlog will stop after the gnulib submodule:
> ===
> $ vc-chlog
> 2015-07-22  gordon  <gordon@hostname>
>
>         * bootstrap.conf:
>         * gnulib:
> ===
>
> A bit of debugging seems to show that in 'vc-chlog', the output of
> 'processed-diff()' is:
>    bootstrap.conf 1 3 9 0-0-122-122
>    gnulib 1 11 15 1-1-1-1
>    src/hello.c 1 18 24 0-0-190-190
>
> Then 'func_extract_identifiers()' calls 'func_apply_tmp_patch()' which runs
> 'patch', and patch fails.
>  One possible work-around is to ignore submodules in 'vc-dwim' (attached
> patch).
>
> Another possible thing is to make 'vc-dwim' abort if there are dirty
> submodules, on the assumption that 'vc-dwim' is meant to prevent problematic
> commits, and a dirty submodule is a hint of a potential problem.
> related to this approach, there was a discussion couple of months about
> about adding a server-side git hook in savannah to prevent such commits, but
> it was decided against such forcible approach. perhaps warning about dirty
> submodules in 'vc-dwim' is more polite?
>   http://lists.gnu.org/archive/html/coreutils/2015-04/msg00017.html

Hi Assaf,

Wow. Thank you for diving in and writing all of that.
Issuing a warning does have a little more appeal to me, but I would be happy
with a complete patch implementing either behavior (i.e., updating NEWS
and adding a test).

Are you inclined to write that?




Information forwarded to bug-vc-dwim@HIDDEN:
bug#21120; Package vc-dwim. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Jul 2015 00:10:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 22 20:10:42 2015
Received: from localhost ([127.0.0.1]:56776 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZI45w-0007PP-FC
	for submit <at> debbugs.gnu.org; Wed, 22 Jul 2015 20:10:41 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42268)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <assafgordon@HIDDEN>) id 1ZI45u-0007PH-Cd
 for submit <at> debbugs.gnu.org; Wed, 22 Jul 2015 20:10:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <assafgordon@HIDDEN>) id 1ZI45s-0008EI-KB
 for submit <at> debbugs.gnu.org; Wed, 22 Jul 2015 20:10:37 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:42605)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <assafgordon@HIDDEN>) id 1ZI45s-0008EA-Fl
 for submit <at> debbugs.gnu.org; Wed, 22 Jul 2015 20:10:36 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55757)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <assafgordon@HIDDEN>) id 1ZI45r-00076O-AB
 for bug-vc-dwim@HIDDEN; Wed, 22 Jul 2015 20:10:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <assafgordon@HIDDEN>) id 1ZI45m-0008BD-95
 for bug-vc-dwim@HIDDEN; Wed, 22 Jul 2015 20:10:35 -0400
Received: from mail-qk0-x230.google.com ([2607:f8b0:400d:c09::230]:35305)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <assafgordon@HIDDEN>) id 1ZI3qR-0001N4-Nv
 for bug-vc-dwim@HIDDEN; Wed, 22 Jul 2015 19:54:39 -0400
Received: by qkbm65 with SMTP id m65so109725166qkb.2
 for <bug-vc-dwim@HIDDEN>; Wed, 22 Jul 2015 16:54:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=message-id:date:from:user-agent:mime-version:to:subject
 :content-type; bh=9JKpu0z4/biIFLLHz4hhRaP1NRAnPGRmYA7qIWHHoKo=;
 b=Nc4GfjPnfUtwqs7DKCCtjTlAMDhjTQN9hyoGHDC8hN5IPdqLmqzdl6n8JKvG+Nemex
 aZytlWWy2waIWOG2ov8PX6DOfxy4lvokflmpVSIKAPK1TXqqIJU/VUi7zbrJZbdLBPNE
 ccn9wVOjhjYfs/tJgopZPs1O8yylFYSpwqnAXnH9E1IMieTw+AN3jdqih87Bh1oPJTMb
 kjG3FGwtVz+mJ2bKtt0kgp4uAWoMIwyiLQwIO3HHC3DvNwhGZTsM+ahoy+mUarOFJimF
 HKHdgcymG2wETjY52kHUPBMliljr2wFAkEUlAyCXemhEpeCFLcsbxJK1QdVZdA6GjMzp
 2nCg==
X-Received: by 10.55.25.35 with SMTP id k35mr7734431qkh.76.1437609278290;
 Wed, 22 Jul 2015 16:54:38 -0700 (PDT)
Received: from disco.erlich.nygenome.org ([162.212.111.2])
 by smtp.googlemail.com with ESMTPSA id f4sm1560128qga.5.2015.07.22.16.54.37
 for <bug-vc-dwim@HIDDEN>
 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Wed, 22 Jul 2015 16:54:37 -0700 (PDT)
Message-ID: <55B02D47.5060203@HIDDEN>
Date: Wed, 22 Jul 2015 19:54:47 -0400
From: Assaf Gordon <assafgordon@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version: 1.0
To: bug-vc-dwim@HIDDEN
Subject: vc-chlog fails if git submodules are dirty
Content-Type: multipart/mixed; boundary="------------040506060208040001080901"
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

This is a multi-part message in MIME format.
--------------040506060208040001080901
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

it seems that if a project using git has a submodule that is dirty, vc-chlog will fail to print the information about all the files.

To reproduce:
====
    git clone git://git.sv.gnu.org/hello.git
    cd hello/
    ./bootstrap
    echo >> bootstrap.conf
    echo >> gnulib/cfg.mk
    echo >> src/hello.c
====

The diff looks like this:
===
$ git diff
diff --git a/bootstrap.conf b/bootstrap.conf
index 9e6b005..79d4c5b 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -119,3 +119,4 @@ bootstrap_epilogue()
      done
    fi
  }
+
diff --git a/gnulib b/gnulib
--- a/gnulib
+++ b/gnulib
@@ -1 +1 @@
-Subproject commit b9bfe78424b871f5b92e5ee9e7d21ef951a6801d
+Subproject commit b9bfe78424b871f5b92e5ee9e7d21ef951a6801d-dirty
diff --git a/src/hello.c b/src/hello.c
index 8e6cfbd..f0d12de 100644
--- a/src/hello.c
+++ b/src/hello.c
@@ -187,3 +187,4 @@ License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
  This is free software: you are free to change and redistribute it.\n\
  There is NO WARRANTY, to the extent permitted by law.\n"), COPYRIGHT_YEAR);
  }
+
===

But vc-chlog will stop after the gnulib submodule:
===
$ vc-chlog
2015-07-22  gordon  <gordon@hostname>

	* bootstrap.conf:
	* gnulib:
===

A bit of debugging seems to show that in 'vc-chlog', the output of 'processed-diff()' is:
    bootstrap.conf 1 3 9 0-0-122-122
    gnulib 1 11 15 1-1-1-1
    src/hello.c 1 18 24 0-0-190-190

Then 'func_extract_identifiers()' calls 'func_apply_tmp_patch()' which runs 'patch', and patch fails.
  
One possible work-around is to ignore submodules in 'vc-dwim' (attached patch).

Another possible thing is to make 'vc-dwim' abort if there are dirty submodules, on the assumption that 'vc-dwim' is meant to prevent problematic commits, and a dirty submodule is a hint of a potential problem.
related to this approach, there was a discussion couple of months about about adding a server-side git hook in savannah to prevent such commits, but it was decided against such forcible approach. perhaps warning about dirty submodules in 'vc-dwim' is more polite?
   http://lists.gnu.org/archive/html/coreutils/2015-04/msg00017.html


regards,
  - assaf





--------------040506060208040001080901
Content-Type: text/x-diff;
 name="vc-dwim-ignore-git-submodules.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="vc-dwim-ignore-git-submodules.patch"

From fb509424ca4b2b5f69f4ab52959d1cb03e7ebd5a Mon Sep 17 00:00:00 2001
From: Assaf Gordon <assafgordon@HIDDEN>
Date: Wed, 22 Jul 2015 19:40:52 -0400
Subject: [PATCH] VC.pm: ignore changes in git submodules

---
 VC.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/VC.pm b/VC.pm
index 81a2390..039f312 100644
--- a/VC.pm
+++ b/VC.pm
@@ -57,8 +57,9 @@ my $vc_cmd =
    GIT() =>
    {
     AUTHOR_FMT => '--author=%s',
-    DIFF_COMMAND => [qw(git diff -B -C HEAD --)],
-    DIFF_PRISTINE => [qw(git diff --no-ext-diff -B -C HEAD --)],
+    DIFF_COMMAND => [qw(git diff --ignore-submodules=all -B -C HEAD --)],
+    DIFF_PRISTINE => [qw(git diff --ignore-submodules=all --no-ext-diff
+                         -B -C HEAD --)],
     VALID_DIFF_EXIT_STATUS => {0 => 1},
     COMMIT_COMMAND => [qw(git commit -q -F)],
     # is-version-controlled-file: true, if "git cat-file -t HEAD:$file"
-- 
1.9.1


--------------040506060208040001080901--




Acknowledgement sent to Assaf Gordon <assafgordon@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-vc-dwim@HIDDEN. Full text available.
Report forwarded to bug-vc-dwim@HIDDEN:
bug#21120; Package vc-dwim. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.