git try exceptions

323 views
Skip to first unread message

Marc-Antoine Ruel

unread,
Sep 27, 2011, 11:11:56 AM9/27/11
to chromium-dev
If you get a git-try exception, run this command:

rm -rf $(dirname $(which git-try))/git_cl

These damn .pyc files.

M-A

Scott Graham

unread,
Sep 27, 2011, 4:08:37 PM9/27/11
to maruel...@google.com, chromium-dev
Hi,

Does this refer to the following error?

c:\src\chromium\src>git try --bot win
Loaded authentication cookies from c:/Users/scottmg/.codereview_upload_cookies
Command git diff --name-status -r refs/remotes/origin/trunk...
c:\src\chromium\src returned non-zero exit status 128
fatal: invalid diff option/value: -r

I tried deleting rmdir /s/q depot_tools\git_cl per your instructions,
but did not help. Do I need to install a new version of git perhaps?

> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev
>

Marc-Antoine Ruel

unread,
Sep 27, 2011, 4:10:28 PM9/27/11
to Scott Graham, maruel...@google.com, chromium-dev
git --version ?

Scott Graham

unread,
Sep 27, 2011, 4:35:08 PM9/27/11
to Marc-Antoine Ruel, maruel...@google.com, chromium-dev
c:\src\chromium\src>git --versiongit version 1.7.6.msysgit.0
c:\src\chromium\src>git diff --name-status -r
refs/remotes/origin/trunk...M       build/common.gypiA
tools/win/supalink/OWNERSA       tools/win/supalink/READMEA
tools/win/supalink/check_installed.pyA
tools/win/supalink/install_supalink.pyA
tools/win/supalink/supalink.cpp
I'm confused. Maybe something is re-invoking git and getting a different PATH?

Scott Graham

unread,
Sep 27, 2011, 4:46:35 PM9/27/11
to Marc-Antoine Ruel, maruel...@google.com, chromium-dev
Well that was butchered by line-wrap, and I ran the wrong command it seems.

Anyway, running

git diff --name-status -r refs/remotes/origin/trunk... c:\src\chromium\src

errors out with the same error as git try does (invalid diff
option/value -r), and git --version is

git version 1.7.6.msysgit.0

I seem to get the same error with a similar style command line on a
linux machine with git version 1.7.3.1.

Jay Soffian

unread,
Sep 27, 2011, 10:32:25 PM9/27/11
to sco...@chromium.org, Marc-Antoine Ruel, maruel...@google.com, chromium-dev
On Tue, Sep 27, 2011 at 4:46 PM, Scott Graham <sco...@chromium.org> wrote:
> Well that was butchered by line-wrap, and I ran the wrong command it seems.
>
> Anyway, running
>
> git diff --name-status -r refs/remotes/origin/trunk... c:\src\chromium\src
>
> errors out with the same error as git try does (invalid diff
> option/value -r), and git --version is
>
> git version 1.7.6.msysgit.0
>
> I seem to get the same error with a similar style command line on a
> linux machine with git version 1.7.3.1.

So "-r" is technically not a valid option to anything but
git-diff-tree, but git's diff argument parsing is heavily shared, so
it's a no-op 99% of the time. (The "-r" option is handled in
revision.c)

You however hit seem to have hit diff_no_index, where the option is
invalid. diff_no_index is run when you run git with --no-index (which
you aren't doing), OR when you use git diff outside a repo. So my
guess is that git doesn't think you're CWD is actually inside a proper
git repo.

And yes, diff_no_index could fail with a better error message here.
@maruel - you might want to remove the "-r" inside scm.py on this git
call - it's a no-op 99% of the time, but in this case it's hiding a
slightly better error message, which would likely be "error: Could not
access 'refs/remotes/origin/trunk...'" without the "-r".)

j.

Scott Graham

unread,
Sep 28, 2011, 12:51:17 PM9/28/11
to Jay Soffian, Marc-Antoine Ruel, maruel...@google.com, chromium-dev

Thanks Jay. Assuming your psychic debugging is correct (and I do
indeed get the error you suggest if I remove -r), that raises the
question: why does git think it's not a git repo? i.e.

c:\src\chromium\src>type .git\refs\remotes\origin\trunk
05b7b785a7c133bbde6dc355b4d4637a2a2176d0

c:\src\chromium\src>git cat-file -p 05b7b785a7c133bbde6dc355b4d4637a2a2176d0
tree 436c37851df42c10fa0914d3f6e1e9989edbbf45
parent c97d4bf90ce19a32376164c409c8071f62dcf921
...

I added a few prints in scm.py but nothing is jumping out as broken looking.

I assume this is only happening for me? If so, since I have to switch
git "styles" anyway, I'll just take this clone Out Behind The Barn,
switch to NewGit-stylez and we can all pretend this never happened.

Greg Thompson

unread,
Sep 28, 2011, 5:24:40 PM9/28/11
to sco...@chromium.org, Jay Soffian, Marc-Antoine Ruel, maruel...@google.com, chromium-dev
On Wed, Sep 28, 2011 at 12:51 PM, Scott Graham <sco...@chromium.org> wrote:
Thanks Jay. Assuming your psychic debugging is correct (and I do
indeed get the error you suggest if I remove -r), that raises the
question: why does git think it's not a git repo? i.e.

c:\src\chromium\src>type .git\refs\remotes\origin\trunk
05b7b785a7c133bbde6dc355b4d4637a2a2176d0

c:\src\chromium\src>git cat-file -p 05b7b785a7c133bbde6dc355b4d4637a2a2176d0
tree 436c37851df42c10fa0914d3f6e1e9989edbbf45
parent c97d4bf90ce19a32376164c409c8071f62dcf921
...

I added a few prints in scm.py but nothing is jumping out as broken looking.

I assume this is only happening for me? If so, since I have to switch
git "styles" anyway, I'll just take this clone Out Behind The Barn,
switch to NewGit-stylez and we can all pretend this never happened.

 
I'm UsingNewGit in a fairly fresh checkout (two days old, perhaps), and I'm seeing this too:

F:\src\chrome\trunk\src>git --version
git version 1.7.4.msysgit.0

F:\src\chrome\trunk\src>git try
DEBUG:root:git rev-parse --show-cdup
DEBUG:root:git config rietveld.server codereview.chromium.org
DEBUG:root:git config rietveld.cc chromium...@chromium.org
DEBUG:root:git config rietveld.tree-status-url http://chromium-status.appspot.com/status
DEBUG:root:git config rietveld.viewvc-url http://src.chromium.org/viewvc/chrome?view=rev&revision=
DEBUG:root:git config rietveld.server
DEBUG:root:git symbolic-ref HEAD
DEBUG:root:git config branch.98449.merge
DEBUG:root:git config branch.98449.remote
DEBUG:root:git rev-parse --show-cdup
DEBUG:root:git rev-parse HEAD
DEBUG:root:git diff --name-status -r refs/remotes/origin/master... .
DEBUG:root:git rev-parse --git-dir
DEBUG:root:git config branch.98449.rietveldissue
DEBUG:root:git config branch.98449.rietveldserver
DEBUG:root:git config branch.98449.rietveldpatchset
Loaded authentication cookies from c:/Users/grt/.codereview_upload_cookies
DEBUG:root:/8071008/description
DEBUG:root:git config user.email
DEBUG:root:GitAffectedFile(chrome_frame/metrics_service.cc)
DEBUG:root:['--issue', '8071008\n', '--patchset', '1\n']
INFO:root:GuessVCS(F:\src\chrome\trunk\src)
DEBUG:root:git rev-parse --is-inside-work-tree;  cwd=F:\src\chrome\trunk\src
DEBUG:root:git rev-parse --show-cdup;  cwd=F:\src\chrome\trunk\src
DEBUG:root:git rev-parse --short=4 HEAD;  cwd=F:\src\chrome\trunk\src
DEBUG:root:git symbolic-ref HEAD;  cwd=F:\src\chrome\trunk\src
DEBUG:root:git config user.email;  cwd=F:\src\chrome\trunk\src
DEBUG:root:git symbolic-ref HEAD;  cwd=F:\src\chrome\trunk\src
DEBUG:root:git config branch.98449.merge;  cwd=F:\src\chrome\trunk\src
DEBUG:root:git config branch.98449.remote;  cwd=F:\src\chrome\trunk\src
INFO:root:GIT(F:\src\chrome\trunk\src)
INFO:root:Found .gclient at F:\src\chrome\trunk
DEBUG:root:svn info --xml F:\src\chrome\trunk\src
INFO:root:Found codereview.settings at F:\src\chrome\trunk\src
INFO:root:svn_repo: svn://svn.chromium.org/chrome-try/try
DEBUG:root:git diff --name-status -r refs/remotes/origin/master... F:\src\chrome\trunk\src
Command git diff --name-status -r refs/remotes/origin/master... F:\src\chrome\trunk\src returned non-zero exit status 128
fatal: invalid diff option/value: -r

F:\src\chrome\trunk\src>git diff --name-status refs/remotes/origin/master... F:\src\chrome\trunk\src
error: Could not access 'refs/remotes/origin/master...'

So, uh, what do I do now?

Scott Graham

unread,
Sep 28, 2011, 5:29:05 PM9/28/11
to Greg Thompson, Jay Soffian, Marc-Antoine Ruel, maruel...@google.com, chromium-dev
Jay helped me track it down to the problem at least (thanks!), but I haven't figured out what the fix should be. Seems to be caused by \ vs /. (see static int path_outside_repo(const char *path) in git)

c:\src\chromium\src>git rev-parse --show-toplevel
c:/src/chromium/src

c:\src\chromium\src>git rev-parse --is-inside-work-tree
true


c:\src\chromium\src>git diff --name-status -r refs/remotes/origin/trunk... c:\src\chromium\src
fatal: invalid diff option/value: -r

c:\src\chromium\src>git diff --name-status -r refs/remotes/origin/trunk... c:/src/chromium/src
M       build/common.gypi
...

Scott Graham

unread,
Sep 28, 2011, 7:28:05 PM9/28/11
to Greg Thompson, Jay Soffian, Marc-Antoine Ruel, maruel...@google.com
Hack patch if you want to submit a try from Windows. There's a lot of places that reference self.checkout_root, and pass it on, so I couldn't (easily) decide if it's a good idea to store as / or not. It's currently abspath'd when found.

Index: trychange.py
===================================================================
--- trychange.py        (revision 103193)
+++ trychange.py        (working copy)
@@ -283,7 +283,7 @@
     logging.info("GIT(%s)" % self.checkout_root)

   def CaptureStatus(self):
-    return scm.GIT.CaptureStatus(self.checkout_root, self.diff_against)
+    return scm.GIT.CaptureStatus(self.checkout_root.replace('\\', '/'), self.diff_against)

   def GenerateDiff(self):
     return scm.GIT.GenerateDiff(self.checkout_root, files=self.files,
Reply all
Reply to author
Forward
0 new messages