Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-tools.git;a=commitdiff;h=32522a8d620afd71897208465ed2405fb89f06d3

commit 32522a8d620afd71897208465ed2405fb89f06d3
Author: Miklos Vajna <vmik...@frugalware.org>
Date:   Fri May 20 14:33:03 2016 +0200

darcs-git: respect svn-remote.svn.fetch

E.g. the LLVM project recommends setting that, and then without this the
following scenario was broken:

- create a local commit
- type dg push to get a quick list of local commits

Internally git log was given a wrong base. When the above config key is
unset, the default is still the same.

diff --git a/darcs-git.py b/darcs-git.py
index e98daba..bcdbbfe 100755
--- a/darcs-git.py
+++ b/darcs-git.py
@@ -142,6 +142,16 @@ def svn_check():
sock.close()
return os.path.exists(os.path.join(cdup, ".git/svn"))

+def svn_get_remote():
+       sock = os.popen("git config svn-remote.svn.fetch")
+       # Returns something like ':refs/remotes/origin/master'.
+       fetch = sock.readline().strip()
+       sock.close()
+       if not len(fetch):
+               return "git-svn"
+       else:
+               return fetch[1:]
+
def darcs_check():
sock = os.popen("git rev-parse --show-cdup")
cdup = sock.read().strip()
@@ -630,7 +640,7 @@ Options:
usage(0)
remote = "%s/%s" % (options.gitopts, get_merge(branch))
if svn_check():
-               remote = "git-svn"
+               remote = svn_get_remote()
elif darcs_check():
remote = "darcs/upstream"
logopts = ""
@@ -710,7 +720,7 @@ Options:
os.system("git fetch %s" % options.gitopts)
remote = "%s/%s" % (options.gitopts, get_merge(branch))
if svn_check():
-               remote = "git-svn"
+               remote = svn_get_remote()
elif darcs_check():
remote = "darcs/upstream"
sock = os.popen("git log %s..%s 2>&1" % (branch, remote))
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to