Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Tvangeste
Hi,

After bisecting this problem I ended up with the mentioned commit that 
completely breaks git-svn for me on Windows (mingw/msys version).

==
# git svn rebase
warning: unable to access '': Invalid argument
warning: unable to access '': Invalid argument
fatal: unable to access '../../../../w:/work/my/repo.git/.git/config': Invalid 
argument
fatal: index file open failed: Invalid argument
Cannot rebase: You have unstaged changes.
Please commit or stash them.
rebase refs/remotes/trunk: command returned error: 1
==

Please note that I use the official git repository as-is, this one (no 
additional patches):
git://git.kernel.org/pub/scm/git/git.git

e02ca72f70ed8f0268a81f72cb3230c72e538e77 is the first bad commit
commit e02ca72f70ed8f0268a81f72cb3230c72e538e77
Author: Jiang Xin
Date:   Tue Jun 25 23:53:43 2013 +0800

path.c: refactor relative_path(), not only strip prefix

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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Johannes Schindelin
Hi Tvangeste,

On Tue, 10 Sep 2013, Tvangeste wrote:

 After bisecting this problem I ended up with the mentioned commit that
 completely breaks git-svn for me on Windows (mingw/msys version).

Have you tried with Git for Windows yet?

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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Johannes Sixt
Am 10.09.2013 15:14, schrieb Tvangeste:
 After bisecting this problem I ended up with the mentioned commit
 that completely breaks git-svn for me on Windows (mingw/msys version).
 
 ==
 # git svn rebase
 warning: unable to access '': Invalid argument
 warning: unable to access '': Invalid argument
 fatal: unable to access '../../../../w:/work/my/repo.git/.git/config': 
 Invalid argument
 fatal: index file open failed: Invalid argument
 Cannot rebase: You have unstaged changes.
 Please commit or stash them.
 rebase refs/remotes/trunk: command returned error: 1
 ==

Can you please run the command with GIT_TRACE=2?

-- Hannes

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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Junio C Hamano
Tvangeste i.4m.l...@yandex.ru writes:

 Hi,

 After bisecting this problem I ended up with the mentioned commit that 
 completely breaks git-svn for me on Windows (mingw/msys version).

 ==
 # git svn rebase
 warning: unable to access '': Invalid argument
 warning: unable to access '': Invalid argument
 fatal: unable to access '../../../../w:/work/my/repo.git/.git/config': 
 Invalid argument
 fatal: index file open failed: Invalid argument
 Cannot rebase: You have unstaged changes.
 Please commit or stash them.
 rebase refs/remotes/trunk: command returned error: 1
 ==

 Please note that I use the official git repository as-is, this one (no 
 additional patches):
 git://git.kernel.org/pub/scm/git/git.git

 e02ca72f70ed8f0268a81f72cb3230c72e538e77 is the first bad commit
 commit e02ca72f70ed8f0268a81f72cb3230c72e538e77
 Author: Jiang Xin
 Date:   Tue Jun 25 23:53:43 2013 +0800

 path.c: refactor relative_path(), not only strip prefix

 Thanks,
   --Tvangeste

The suspect commit and symptom look consistent.  You started from a
directory whose absolute path is w:/work/... and the updated code
mistakenly thoguht that something that begins with w (not '/') is
not an absolute, so added a series of ../ to make it relative, or
something silly like that.

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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Tvangeste
10.09.2013, 18:13, Johannes Schindelin johannes.schinde...@gmx.de:
 Have you tried with Git for Windows yet?

What's Git for Windows? If you mean msysgit, then I say no, because the latest 
msysgit version is from June 02, and the change under discussion was made later 
on, on June 25th. So, this regression is not in msysgit release (yet).

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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Tvangeste
10.09.2013, 18:53, Johannes Sixt j...@kdbg.org:
 Can you please run the command with GIT_TRACE=2?

Sure:
# git --version
trace: built-in: git 'version'
git version 1.8.4.242.gbb80ee0

# git svn rebase -l
trace: exec: 'git-svn' 'rebase' '-l'
trace: run_command: 'git-svn' 'rebase' '-l'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--show-cdup'
trace: built-in: git 'config' '--bool' '--get' 'svn.fetchall'
trace: built-in: git 'config' '--bool' '--get' 'svn.noauthcache'
trace: built-in: git 'config' '--bool' '--get' 'svn.nocheckout'
trace: built-in: git 'config' '--get' 'svn.authorsprog'
trace: built-in: git 'config' '--bool' '--get' 'svn.dryrun'
trace: built-in: git 'config' '--bool' '--get' 'svn.preservemerges'
trace: built-in: git 'config' '--bool' '--get' 'svn.followparent'
trace: built-in: git 'config' '--bool' '--get' 'svn.useSvmProps'
trace: built-in: git 'config' '--get' 'svn.authorsfile'
trace: built-in: git 'config' '--get' 'svn.username'
trace: built-in: git 'config' '--get' 'svn.repackflags'
trace: built-in: git 'config' '--bool' '--get' 'svn.localtime'
trace: built-in: git 'config' '--int' '--get' 'svn.repack'
trace: built-in: git 'config' '--get' 'svn.ignorepaths'
trace: built-in: git 'config' '--bool' '--get' 'svn.verbose'
trace: built-in: git 'config' '--bool' '--get' 'svn.quiet'
trace: built-in: git 'config' '--int' '--get' 'svn.logwindowsize'
trace: built-in: git 'config' '--get' 'svn.ignorerefs'
trace: built-in: git 'config' '--get' 'svn.configdir'
trace: built-in: git 'config' '--bool' '--get' 'svn.merge'
trace: built-in: git 'config' '--bool' '--get' 'svn.addauthorfrom'
trace: built-in: git 'config' '--bool' '--get' 'svn.useSvnsyncProps'
trace: built-in: git 'config' '--bool' '--get' 'svn.noMetadata'
trace: built-in: git 'config' '--bool' '--get' 'svn.local'
trace: built-in: git 'config' '--get' 'svn.strategy'
trace: built-in: git 'config' '--get' 'svn.includepaths'
trace: built-in: git 'config' '--bool' '--get' 'svn.uselogauthor'
trace: built-in: git 'rev-parse' '--symbolic' '--all'
trace: built-in: git 'config' '-l'
trace: built-in: git 'config' '-l'
trace: built-in: git 'update-index' '--refresh'
trace: built-in: git 'rev-list' '--first-parent' '--pretty=medium' 'HEAD' '--'
trace: built-in: git 'config' '--bool' 'svn.useSvmProps'
trace: built-in: git 'config' '-l'
trace: built-in: git 'for-each-ref' '--format=%(refname)' 'refs/'
trace: built-in: git 'for-each-ref' '--format=%(refname)' 'refs/'
trace: built-in: git 'for-each-ref' '--format=%(refname)' 'refs/'
trace: built-in: git 'for-each-ref' '--format=%(refname)' 'refs/'
trace: built-in: git 'for-each-ref' '--format=%(refname)' 'refs/'
trace: built-in: git 'config' '--get' 'svn-remote.svn.rewriteRoot'
trace: built-in: git 'config' '--get' 'svn-remote.svn.url'
trace: built-in: git 'config' '--get' 'svn-remote.svn.pushurl'
trace: built-in: git 'config' '--get' 'svn-remote.svn.uuid'
trace: built-in: git 'rev-list' '--pretty=raw' '--reverse' 
'cdc459d7cedcec6bb26812e24661c7318f031be4..refs/remotes/trunk' '--'
trace: built-in: git 'config' '--get' 'svn-remote.svn.rewriteRoot'
trace: built-in: git 'config' '--get' 'svn-remote.svn.rewriteUUID'
trace: built-in: git 'diff-index' 'HEAD' '--'
trace: exec: 'git-rebase' 'refs/remotes/trunk'
trace: run_command: 'git-rebase' 'refs/remotes/trunk'
trace: built-in: git 'rev-parse' '--parseopt' '--' 'refs/remotes/trunk'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-bare-repository'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'config' '--bool' 'rebase.stat'
trace: built-in: git 'config' '--bool' 'rebase.autostash'
trace: built-in: git 'config' '--bool' 'rebase.autosquash'
trace: built-in: git 'rev-parse' '--verify' 'refs/remotes/trunk^0'
trace: built-in: git 'rev-parse' '--verify' 'refs/remotes/trunk^0'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'update-index' '-q' '--ignore-submodules' '--refresh'
fatal: unable to access 
'../../../../w:/work/xxx/xxx-xxx-OSS.git.new/.git/config': Invalid argument
trace: built-in: git 'diff-files' '--quiet' '--ignore-submodules'
fatal: index file open failed: Invalid argument
Cannot rebase: You have unstaged changes.
trace: built-in: git 'diff-index' '--cached' '--quiet' '--ignore-submodules' 
'HEAD' '--'
Please commit or stash them.
rebase refs/remotes/trunk: command returned error: 1

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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Johannes Schindelin
Hi Tvangeste,

On Tue, 10 Sep 2013, Tvangeste wrote:

 10.09.2013, 18:13, Johannes Schindelin johannes.schinde...@gmx.de:
  Have you tried with Git for Windows yet?
 
 What's Git for Windows? If you mean msysgit,

Actually, they are two different things: Git for Windows is what the name
says, and it comes with an installer. msysGit is the development
environment to *build* Git for Windows.

 then I say no, because the latest msysgit version is from June 02, and
 the change under discussion was made later on, on June 25th. So, this
 regression is not in msysgit release (yet).

Given the explanation what msysGit is, you might suspect that I'd like you
to try to fix this in the msysGit context: After installing

https://code.google.com/p/msysgit/downloads/list?q=net+installer

you will have a full build environment, including the build of our latest
master. You can then cd /git/ and git checkout pt/tentative-1.8.4 
make install to make sure that the version we are very close to releasing
as the new Git for Windows version does not break your workflow.

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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Tvangeste
10.09.2013, 20:02, Johannes Schindelin johannes.schinde...@gmx.de:
  Given the explanation what msysGit is, you might suspect that I'd like you
  to try to fix this in the msysGit context: After installing

  https://code.google.com/p/msysgit/downloads/list?q=net+installer

No problem. Here's what I have so far:

1. Installed the latest msysgit from the URL you've provided. Tried the git 
that comes out of the box that comes with the installer (1.8.3.msysgit):

1a. On CMD: everything is fine.
1b. On msys shell: everything is fine.

2. Checked out the branch you've suggested to try (pt/tentative-1.8.4) and 
installed it. Tried the new version:

2a. On CMD: got the problem that is being discussed in this thread.
2b. On msys shell: everything is fine.

So, in summary. That commit e02ca72, somewhere between 1.8.3 and 1.8.4 
introduced the regression in git/git-svn on Windows, when executed in CMD.

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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Karsten Blees
Junio C Hamano gitster at pobox.com writes:

 
 Tvangeste i.4m.l33t at yandex.ru writes:
 
  Hi,
 
  After bisecting this problem I ended up with the mentioned commit that
completely breaks git-svn for me on
 Windows (mingw/msys version).
 
  ==
  # git svn rebase
  warning: unable to access '': Invalid argument
  warning: unable to access '': Invalid argument
  fatal: unable to access '../../../../w:/work/my/repo.git/.git/config':
Invalid argument
  fatal: index file open failed: Invalid argument
  Cannot rebase: You have unstaged changes.
  Please commit or stash them.
  rebase refs/remotes/trunk: command returned error: 1
  ==
 
  Please note that I use the official git repository as-is, this one (no
additional patches):
  git://git.kernel.org/pub/scm/git/git.git
 
  e02ca72f70ed8f0268a81f72cb3230c72e538e77 is the first bad commit
  commit e02ca72f70ed8f0268a81f72cb3230c72e538e77
  Author: Jiang Xin
  Date:   Tue Jun 25 23:53:43 2013 +0800
 
  path.c: refactor relative_path(), not only strip prefix
 
  Thanks,
--Tvangeste
 
 The suspect commit and symptom look consistent.  You started from a
 directory whose absolute path is w:/work/... and the updated code
 mistakenly thoguht that something that begins with w (not '/') is
 not an absolute, so added a series of ../ to make it relative, or
 something silly like that.
 
 Jiang?
 

Indeed, this patch seems to change relative_path in a way that breaks git
initialization, not just on Windows.

Previously, relative_path was always called with two absolute paths, and it
only returned a relative path if the first was a subdir of the second (so a
better name would probably have been 'relative_path_if_subdir'). The purpose
was to improve performance by making GIT_DIR shorter if it was a subdir of
GIT_WORK_TREE.

After this patch, relative_path always tries to return a relative path, even
if both absolute paths are completely disjunct. This not only defeats the
purpose (by making GIT_DIR longer, thus hurting performance), it is also not
possible in general. POSIX explicitly allows for '//hostname' notation
referring to network resources that are not explicitly mounted under '/'.
I.e. given two absolute paths '//hostname1/a' and '//hostname2/b', there is
no relative path from a to b or vice versa.

Additionally, GIT_DIR now may or may not have a trailing slash, which gives
me a slightly uneasy feeling...




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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Jiang Xin
2013/9/11 Junio C Hamano gits...@pobox.com:
 Tvangeste i.4m.l...@yandex.ru writes:

 Hi,

 After bisecting this problem I ended up with the mentioned commit that 
 completely breaks git-svn for me on Windows (mingw/msys version).

 ==
 # git svn rebase
 warning: unable to access '': Invalid argument
 warning: unable to access '': Invalid argument
 fatal: unable to access '../../../../w:/work/my/repo.git/.git/config': 
 Invalid argument
 fatal: index file open failed: Invalid argument
 Cannot rebase: You have unstaged changes.
 Please commit or stash them.
 rebase refs/remotes/trunk: command returned error: 1
 ==

 Please note that I use the official git repository as-is, this one (no 
 additional patches):
 git://git.kernel.org/pub/scm/git/git.git

 e02ca72f70ed8f0268a81f72cb3230c72e538e77 is the first bad commit
 commit e02ca72f70ed8f0268a81f72cb3230c72e538e77
 Author: Jiang Xin
 Date:   Tue Jun 25 23:53:43 2013 +0800

 path.c: refactor relative_path(), not only strip prefix

 Thanks,
   --Tvangeste

 The suspect commit and symptom look consistent.  You started from a
 directory whose absolute path is w:/work/... and the updated code
 mistakenly thoguht that something that begins with w (not '/') is
 not an absolute, so added a series of ../ to make it relative, or
 something silly like that.

 Jiang?

I tested 'relative_path' function using 'test-path-utils', and got the
following result:

$ ./test-path-utils relative_path 'C:/a/b' 'D:/x/y'
../../../C:/a/b

$ ./test-path-utils relative_path '/a/b' 'x/y'
../..//a/b

$ ./test-path-utils relative_path 'a/b' '/x/y'
../../../a/b

For the first case, in and prefix are on different ROOT, and for the other
two cases, one path is a relative path, and another is an absolute path.

I write a patch to test whether two paths (in and prefix) have the same
root. The result after applied the patch:

$ ./test-path-utils relative_path 'C:/a/b' 'C:/x/y'
../../a/b

$ ./test-path-utils relative_path 'C:/a/b' 'D:/x/y'
C:/a/b

$ ./test-path-utils relative_path '/a/b' 'x/y'
/a/b

$ ./test-path-utils relative_path 'a/b' '/x/y'
a/b


diff --git a/path.c b/path.c
index 7f3324a..51f5d28 100644
--- a/path.c
+++ b/path.c
@@ -441,6 +441,25 @@ int adjust_shared_perm(const char *path)
return 0;
 }

+static int have_same_root(const char *path1, const char *path2)
+{
+   /* for POSIX:
+
+  return ((path1  is_dir_sep(*path1)) ^
+  (path2  is_dir_sep(*path2))) == 0;
+   */
+   return path1  path2  *path1  *path2  (
+   (is_dir_sep(*path1) 
+is_dir_sep(*path2)) ||
+   (*(path1+1) == ':' 
+*(path2+1) == ':' 
+!strncasecmp(path1, path2, 1)) ||
+   (!is_dir_sep(*path1) 
+!is_dir_sep(*path2) 
+*(path1+1) != ':' 
+*(path2+1) != ':'));
+}
+
 /*
  * Give path as relative to prefix.
  *
@@ -461,6 +480,9 @@ const char *relative_path(const char *in, const
char *prefix,
else if (!prefix_len)
return in;

+   if (!have_same_root(in, prefix))
+   return in;
+

Should I write the function have_same_root as inline function or macro
like 'is_dir_sep'?

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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Jiang Xin
2013/9/11 Karsten Blees karsten.bl...@gmail.com:
 Junio C Hamano gitster at pobox.com writes:

 The suspect commit and symptom look consistent.  You started from a
 directory whose absolute path is w:/work/... and the updated code
 mistakenly thoguht that something that begins with w (not '/') is
 not an absolute, so added a series of ../ to make it relative, or
 something silly like that.

 Jiang?


 Indeed, this patch seems to change relative_path in a way that breaks git
 initialization, not just on Windows.

 Previously, relative_path was always called with two absolute paths, and it
 only returned a relative path if the first was a subdir of the second (so a
 better name would probably have been 'relative_path_if_subdir'). The purpose
 was to improve performance by making GIT_DIR shorter if it was a subdir of
 GIT_WORK_TREE.

Yes, it's what commit v1.5.6-1-g044bbbc says.

 After this patch, relative_path always tries to return a relative path, even
 if both absolute paths are completely disjunct. This not only defeats the
 purpose (by making GIT_DIR longer, thus hurting performance), it is also not

Sometimes longer, sometimes shorter maybe.

 possible in general. POSIX explicitly allows for '//hostname' notation
 referring to network resources that are not explicitly mounted under '/'.
 I.e. given two absolute paths '//hostname1/a' and '//hostname2/b', there is
 no relative path from a to b or vice versa.

Yes, path like //hostname/path can be used on Windows.
My hack have_same_root does not cover this case, so using
a simple_relative_path function instead of relative_path in setup.c
may be the better.


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


Re: Regression in e02ca72: git svn rebase is broken on Windows

2013-09-10 Thread Johannes Sixt
Am 11.09.2013 05:19, schrieb Jiang Xin:
 I tested 'relative_path' function using 'test-path-utils', and got the
 following result:
 
 $ ./test-path-utils relative_path 'C:/a/b' 'D:/x/y'
 ../../../C:/a/b
 
 $ ./test-path-utils relative_path '/a/b' 'x/y'
 ../..//a/b
 
 $ ./test-path-utils relative_path 'a/b' '/x/y'
 ../../../a/b
 
 For the first case, in and prefix are on different ROOT, and for the other
 two cases, one path is a relative path, and another is an absolute path.
 
 I write a patch to test whether two paths (in and prefix) have the same
 root. The result after applied the patch:
 
 $ ./test-path-utils relative_path 'C:/a/b' 'C:/x/y'
 ../../a/b
 
 $ ./test-path-utils relative_path 'C:/a/b' 'D:/x/y'
 C:/a/b
 
 $ ./test-path-utils relative_path '/a/b' 'x/y'
 /a/b
 
 $ ./test-path-utils relative_path 'a/b' '/x/y'
 a/b
 
 
 diff --git a/path.c b/path.c
 index 7f3324a..51f5d28 100644
 --- a/path.c
 +++ b/path.c
 @@ -441,6 +441,25 @@ int adjust_shared_perm(const char *path)
 return 0;
  }
 
 +static int have_same_root(const char *path1, const char *path2)
 +{
 +   /* for POSIX:
 +
 +  return ((path1  is_dir_sep(*path1)) ^
 +  (path2  is_dir_sep(*path2))) == 0;
 +   */
 +   return path1  path2  *path1  *path2  (
 +   (is_dir_sep(*path1) 
 +is_dir_sep(*path2)) ||
 +   (*(path1+1) == ':' 
 +*(path2+1) == ':' 
 +!strncasecmp(path1, path2, 1)) ||
 +   (!is_dir_sep(*path1) 
 +!is_dir_sep(*path2) 
 +*(path1+1) != ':' 
 +*(path2+1) != ':'));

I think this can be simplified to

return path1  path2 
is_absolute_path(path1) 
is_absolute_path(path2) 
!strncasecmp(path1, path2, 1);

which would not mistake a path D:/foo on Unix as an absolute path.

 +}

-- Hannes

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