Re: Fatal error running status in new repo

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

 



On Mon, Feb 15, 2010 at 10:24:22PM -0800, Jacob Helwig wrote:

[in an empty repo]
> $ GIT_TRACE=1 git status
> trace: built-in: git 'status'
> # On branch master
> #
> # Initial commit
> #
[...]
> trace: run_command: 'git-submodule' 'summary' '--cached' '--for-status' '--summary-limit' '-1' 'HEAD'
[...]
> trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD^0'
> warning: ignoring dangling symref HEAD.
[...]
> trace: built-in: git 'diff-index' '--cached' '--raw' 'HEAD' '--' 'HEAD'
> fatal: bad revision 'HEAD'

The patch I just posted elsewhere in the thread fixes the "ignoring
dangling symref" message. The "bad revision 'HEAD'" comes from
diff-index. But as you can see, that diff-index invocation is somewhat
bogus.

It looks like this code (git-submodule.sh:556-562):

        if rev=$(git rev-parse -q --verify "$1^0")
        then
                head=$rev
                shift
        else
                head=HEAD
        fi

is meant to guess whether the argument is a revision or a file limiter,
and if the latter, assume HEAD was meant. Which obviously breaks down
when the argument is HEAD and it is invalid. The patch below seems to
fix it for me, but I have no idea if I am breaking something else.

Can somebody more clueful about the submodule script take a look?

-Peff

---
diff --git a/git-submodule.sh b/git-submodule.sh
index 664f217..4332992 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -555,10 +555,12 @@ cmd_summary() {
 
 	if rev=$(git rev-parse -q --verify "$1^0")
 	then
 		head=$rev
 		shift
+	elif test "$1" = "HEAD"; then
+		return
 	else
 		head=HEAD
 	fi
 
 	if [ -n "$files" ]
--
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]