Bug 31482 - girar-nmu-helper-clone-and-setup-build-commit configures fetch differently from the default result of "git remote add"
Summary: girar-nmu-helper-clone-and-setup-build-commit configures fetch differently fr...
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: girar-nmu (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: viy
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on: 31479
Blocks:
  Show dependency tree
 
Reported: 2015-11-13 12:06 MSK by Ivan Zakharyaschev
Modified: 2015-11-13 19:27 MSK (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2015-11-13 12:06:46 MSK
girar-nmu-1.27-alt1

Look at the code of girar-nmu-helper-clone-and-setup-build-commit (probably, inherited from gear-clone):

git --git-dir=".git" config 'remote.origin.fetch' "refs/heads/*:refs/remotes/origin/heads/*"

This does not follow the default behavior of "git remote add" (see the details below). What do you think?

+++ This bug was initially created as a clone of Bug #31479 +++

mithraen-build-utils-0.1.27-alt1

While using gear-clone, I've noticed that the fetch rule for origin works differently from how the default one created by "git remote add" works.

As a result, some unexpected not nice things happen. For example, I get duplicate remote refs for the refs from origin (probably because of the default operation of "git push"):

~/TOOLS/vc/girar-nmu/girar-nmu $ git branch -r | fgrep sisyphus
  origin/HEAD -> origin/sisyphus
  origin/heads/sisyphus
  origin/sisyphus
~/TOOLS/vc/girar-nmu/girar-nmu $ 

Is this done consciously for some reason? Or this could be done in the standard way?

The current code:

git --git-dir=".git" config 'remote.origin.fetch' "refs/heads/*:refs/remotes/origin/heads/*"

The suggested standard behavior:

git --git-dir=".git" config 'remote.origin.fetch' "refs/heads/*:refs/remotes/origin/*"

An example of the configuration after "git remote add viy@ALT git.alt:/people/viy/packages/girar-nmu.git" -- there is no "heads" infix:

[remote "viy@ALT"]
	url = git.alt:/people/viy/packages/girar-nmu.git
	fetch = +refs/heads/*:refs/remotes/viy@ALT/*

The configuration currently created by gear-clone:

[remote "origin"]
	url = git.alt:packages/girar-nmu
	fetch = refs/heads/*:refs/remotes/origin/heads/*
	push = refs/heads/*:refs/heads/*

What do you think?
Comment 1 Ivan Zakharyaschev 2015-11-13 12:49:48 MSK
Suggested fix:

http://git.altlinux.org/people/imz/packages/girar-nmu.git?p=girar-nmu.git;a=commitdiff;h=aeac03feefc254373df271a6a9b36ba22a1aa670

--- a/girar-nmu-helper-clone-and-setup-build-commit
+++ b/girar-nmu-helper-clone-and-setup-build-commit
@@ -45,7 +45,7 @@ girar-clone-build-commit \
 pushd  "$localgitdir" || exit -1
 git --git-dir=".git" config 'remote.origin.url' "git.alt:packages/$name"
 git --git-dir=".git" config 'remote.origin.push' "refs/heads/*:refs/heads/*"
-git --git-dir=".git" config 'remote.origin.fetch' "refs/heads/*:refs/remotes/origin/heads/*"
+git --git-dir=".git" config 'remote.origin.fetch' "+refs/heads/*:refs/remotes/origin/*"
 gear-rules-restore-branches
 
 : <<'__EOF__'
Comment 2 Ivan Zakharyaschev 2015-11-13 14:11:58 MSK
mitharen@ has reviewed and approved this fix (in mithraen-build-utiils) in https://bugzilla.altlinux.org/show_bug.cgi?id=31479 , so I go ahead and build a new release.
Comment 3 Repository Robot 2015-11-13 15:46:25 MSK
girar-nmu-1.27-alt2 -> sisyphus:

* Fri Nov 13 2015 Ivan Zakharyaschev <imz@altlinux> 1.27-alt2
- girar-nmu-helper-clone-and-setup-build-commit: configure the remote
  in a standard way (like "git remote add" does; ALT#31482).
- minor tweaks in the code:
  - factored out git://git.altlinux.org/gears and
    git://git.altlinux.org/srpms as variables (to become environment
    parameters in future).
  - typo in documentation.
Comment 4 viy 2015-11-13 19:27:00 MSK
Спасибо!
Comment 5 viy 2015-11-13 19:27:47 MSK
Сорри, что вовремя не среагировал, после обеда отлучился по делам.