From: "Lars Hjemli" <hjemli@gmail.com>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: "Fabian Franz" <git@fabian-franz.de>,
git@vger.kernel.org, j.sixt@viscovery.net
Subject: Re: [PATCH v3] submodule: Allow tracking of the newest revision of a branch in a submodule
Date: Fri, 12 Dec 2008 01:31:31 +0100 [thread overview]
Message-ID: <8c5c35580812111631k54657bdcme8f048c77b6765eb@mail.gmail.com> (raw)
In-Reply-To: <7vbpvicuk2.fsf@gitster.siamese.dyndns.org>
On Thu, Dec 11, 2008 at 21:42, Junio C Hamano <gitster@pobox.com> wrote:
> I wonder if you can just set "assume unchanged" bit for the subproject
> gitlink in the index to achieve the same goal.
Using assume-unchanged works, in the sense that the modification to
the submodule is not detected in the containing repo. But running `git
submodule update` will checkout the sha1 recorded in HEAD, and I
suspect Fabian wants something like the hypothetical command `git
submodule update -b [branch]` which could do `(cd sub && git fetch &&
git reset --hard origin/$branch)`.
>
> Or is there more to it?
>
Something like this (probably mangled) patch is needed for 'submodule
status' to behave sensibly when the assume-unchanged bit is turned on
for a submodule path.
diff --git a/git-submodule.sh b/git-submodule.sh
index 2f47e06..375dfbf 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -588,21 +588,21 @@ cmd_status()
do
name=$(module_name "$path") || exit
url=$(git config submodule."$name".url)
+ orgsha1=$(git ls-tree HEAD "$path" | cut -d ' ' -f 3 | cut -f 1)
if test -z "$url" || ! test -d "$path"/.git -o -f "$path"/.git
then
say "-$sha1 $path"
continue;
fi
+ if test -z "$cached"
+ then
+ sha1=$(unset GIT_DIR; cd "$path" && git
rev-parse --verify HEAD)
+ fi
set_name_rev "$path" "$sha1"
- if git diff-files --quiet -- "$path"
+ if test "$sha1" = "$orgsha1"
then
say " $sha1 $path$revname"
else
- if test -z "$cached"
- then
- sha1=$(unset GIT_DIR; cd "$path" &&
git rev-parse --verify HEAD)
- set_name_rev "$path" "$sha1"
- fi
say "+$sha1 $path$revname"
fi
done
next prev parent reply other threads:[~2008-12-12 0:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-11 15:39 [PATCH v3] submodule: Allow tracking of the newest revision of a branch in a submodule Fabian Franz
2008-12-11 20:42 ` Junio C Hamano
2008-12-12 0:21 ` Fabian Franz
2008-12-12 1:17 ` Junio C Hamano
2008-12-12 0:31 ` Lars Hjemli [this message]
2008-12-12 0:59 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8c5c35580812111631k54657bdcme8f048c77b6765eb@mail.gmail.com \
--to=hjemli@gmail.com \
--cc=git@fabian-franz.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).