Re: git does the wrong thing with ambiguous names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alex Riesen wrote:
Alex Riesen, Thu, Jun 07, 2007 01:33:27 +0200:
Alex Riesen, Thu, Jun 07, 2007 00:58:26 +0200:
Brandon Casey, Thu, Jun 07, 2007 00:13:48 +0200:
[snip]
This one is much shorter and less friendly. Suggested by Junio on irc.
It makes checkout always prefer a branch.

diff --git a/git-checkout.sh b/git-checkout.sh
index 6b6facf..282c84f 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -67,6 +67,8 @@ while [ "$#" != "0" ]; do
 			new_name="$arg"
 			if git-show-ref --verify --quiet -- "refs/heads/$arg"
 			then
+				rev=$(git-rev-parse --verify "refs/heads/$arg^0" 2>/dev/null)
+				new="$rev"
 				branch="$arg"
 			fi
 		elif rev=$(git-rev-parse --verify "$arg^{tree}" 2>/dev/null)


This doesn't work.

Now the working directory contents are never updated when switching branches.

Run my test script, or add an 'echo "some data" > a' in your shell code so that the two branches have different contents.

-brandon

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux