Re: [RFC/PATCH 2/3] pull: trivial cleanups
Felipe Contreras wrote: git-pull.sh | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) This one obviously looks good. I'm not sure why you sent it along with the other two patches though. On a related note, I'm interested in fixing pull. What I have on paper so far: - pull.condition = clean-worktree | ff-update | no-local-changes | always | never - pull.action = merge | rebase* | reset - pull.resetType = soft | hard | merge | keep - pull.autostash = true | false (ff-update is satisfied when FETCH_HEAD is directly ahead of refs/remotes/branch, while no-local-changes is satisfied when FETCH_HEAD is directly ahead of refs/heads/branch) Any clue how to design branch-specific pull configuration? -- 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: [RFC/PATCH 2/3] pull: trivial cleanups
On Thu, May 16, 2013 at 3:29 AM, Ramkumar Ramachandra artag...@gmail.com wrote: Felipe Contreras wrote: git-pull.sh | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) This one obviously looks good. I'm not sure why you sent it along with the other two patches though. Because this patch depends on the previous one. On a related note, I'm interested in fixing pull. What I have on paper so far: - pull.condition = clean-worktree | ff-update | no-local-changes | always | never - pull.action = merge | rebase* | reset - pull.resetType = soft | hard | merge | keep - pull.autostash = true | false I don't understand that. But my only concern is that there's no way to do something like: % git fetch backup 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' -- Felipe Contreras -- 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: [RFC/PATCH 2/3] pull: trivial cleanups
Felipe Contreras wrote: But my only concern is that there's no way to do something like: % git fetch backup 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' [remote backup] fetch = refs/tags/*:refs/tags/* fetch = refs/heads/*:refs/heads/* What am I missing? -- 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: [RFC/PATCH 2/3] pull: trivial cleanups
On Thu, May 16, 2013 at 4:34 AM, Ramkumar Ramachandra artag...@gmail.com wrote: Felipe Contreras wrote: But my only concern is that there's no way to do something like: % git fetch backup 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' [remote backup] fetch = refs/tags/*:refs/tags/* fetch = refs/heads/*:refs/heads/* What am I missing? Actually trying that command: % git fetch origin 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' fatal: Refusing to fetch into current branch refs/heads/fc/fast-export/cleanup of non-bare repository fatal: The remote end hung up unexpectedly -- Felipe Contreras -- 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: [RFC/PATCH 2/3] pull: trivial cleanups
Felipe Contreras wrote: % git fetch origin 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' fatal: Refusing to fetch into current branch refs/heads/fc/fast-export/cleanup of non-bare repository fatal: The remote end hung up unexpectedly That's because your HEAD is pointing to something under refs/heads/*: it would work otherwise. When I'm developing on my personal branch, I sometimes do 'git fetch origin master:master +pu:pu +next:next', and it works as expected. When on master branch, I can't git fetch origin master:master and this is a cute safety feature. Either way, I think it's a bad practice to fetch directly into refs/heads/*: you should really be fetching to refs/remotes and then merging your changes in. I do want shortcuts though, which is why I'm interested in fixing pull: there is nothing to fix in fetch as far as I'm concerned. -- 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: [RFC/PATCH 2/3] pull: trivial cleanups
On Thu, May 16, 2013 at 4:54 AM, Ramkumar Ramachandra artag...@gmail.com wrote: Felipe Contreras wrote: % git fetch origin 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' fatal: Refusing to fetch into current branch refs/heads/fc/fast-export/cleanup of non-bare repository fatal: The remote end hung up unexpectedly That's because your HEAD is pointing to something under refs/heads/*: it would work otherwise. When I'm developing on my personal branch, I sometimes do 'git fetch origin master:master +pu:pu +next:next', and it works as expected. When on master branch, I can't git fetch origin master:master and this is a cute safety feature. Now you know what's the problem. Either way, I think it's a bad practice to fetch directly into refs/heads/*: you should really be fetching to refs/remotes and then merging your changes in. I do want shortcuts though, which is why I'm interested in fixing pull: there is nothing to fix in fetch as far as I'm concerned. It doesn't matter if you think it's a bad practice or not, 'git push --mirror' works, and it's possible to update a branch even if HEAD is point to it. There should be a possibility to do the same with 'git fetch'. Right now the user is forced to do something like: git checkout -q -b tmp git fetch origin 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' git checkout -q @{-1} git branch -q -D tmp 2 /dev/null Which doesn't seem to be quite right. -- Felipe Contreras -- 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: [RFC/PATCH 2/3] pull: trivial cleanups
Felipe Contreras wrote: It doesn't matter if you think it's a bad practice or not, 'git push --mirror' works, and it's possible to update a branch even if HEAD is point to it. There should be a possibility to do the same with 'git fetch'. So, introduce a configuration variable to turn off this safety feature? -- 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: [RFC/PATCH 2/3] pull: trivial cleanups
On Thu, May 16, 2013 at 5:18 AM, Ramkumar Ramachandra artag...@gmail.com wrote: Felipe Contreras wrote: It doesn't matter if you think it's a bad practice or not, 'git push --mirror' works, and it's possible to update a branch even if HEAD is point to it. There should be a possibility to do the same with 'git fetch'. So, introduce a configuration variable to turn off this safety feature? I thought you were interested in fixing 'git pull'. My bad. -- Felipe Contreras -- 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: [RFC/PATCH 2/3] pull: trivial cleanups
On Thu, May 16, 2013 at 11:36 AM, Felipe Contreras felipe.contre...@gmail.com wrote: Actually trying that command: % git fetch origin 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' fatal: Refusing to fetch into current branch refs/heads/fc/fast-export/cleanup of non-bare repository fatal: The remote end hung up unexpectedly Can you try something like this instead ? git fetch --update-head-ok # or -u -- 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: [RFC/PATCH 2/3] pull: trivial cleanups
On Thu, May 16, 2013 at 6:54 AM, Antoine Pelisse apeli...@gmail.com wrote: On Thu, May 16, 2013 at 11:36 AM, Felipe Contreras felipe.contre...@gmail.com wrote: Actually trying that command: % git fetch origin 'refs/tags/*:refs/tags/*' 'refs/heads/*:refs/heads/*' fatal: Refusing to fetch into current branch refs/heads/fc/fast-export/cleanup of non-bare repository fatal: The remote end hung up unexpectedly Can you try something like this instead ? git fetch --update-head-ok # or -u Nice! That does the trick. -- Felipe Contreras -- 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
[RFC/PATCH 2/3] pull: trivial cleanups
Signed-off-by: Felipe Contreras felipe.contre...@gmail.com --- git-pull.sh | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/git-pull.sh b/git-pull.sh index 75297c7..b207df2 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -166,9 +166,7 @@ error_on_no_merge_candidates () { op_prep=with fi - curr_branch=${curr_branch#refs/heads/} - upstream=$(git config branch.$curr_branch.merge) - remote=$(git config branch.$curr_branch.remote) + upstream=$(git config branch.$curr_branch_short.merge) if [ $# -gt 1 ]; then if [ $rebase = true ]; then @@ -183,7 +181,7 @@ error_on_no_merge_candidates () { echo You asked to pull from the remote '$1', but did not specify echo a branch. Because this is not the default configured remote echo for your current branch, you must specify a branch on the command line. - elif [ -z $curr_branch -o -z $upstream ]; then + elif [ -z $curr_branch_short -o -z $upstream ]; then . git-parse-remote error_on_missing_default_upstream pull $op_type $op_prep \ git pull remote branch -- 1.8.3.rc1.579.g184e698 -- 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