summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Finally implement "git log --follow"Linus Torvalds2007-06-225-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ok, I've really held off doing this too damn long, because I'm lazy, and I was always hoping that somebody else would do it. But no, people keep asking for it, but nobody actually did anything, so I decided I might as well bite the bullet, and instead of telling people they could add a "--follow" flag to "git log" to do what they want to do, I decided that it looks like I just have to do it for them.. The code wasn't actually that complicated, in that the diffstat for this patch literally says "70 insertions(+), 1 deletions(-)", but I will have to admit that in order to get to this fairly simple patch, you did have to know and understand the internal git diff generation machinery pretty well, and had to really be able to follow how commit generation interacts with generating patches and generating the log. So I suspect that while I was right that it wasn't that hard, I might have been expecting too much of random people - this patch does seem to be firmly in the core "Linus or Junio" territory. To make a long story short: I'm sorry for it taking so long until I just did it. I'm not going to guarantee that this works for everybody, but you really can just look at the patch, and after the appropriate appreciative noises ("Ooh, aah") over how clever I am, you can then just notice that the code itself isn't really that complicated. All the real new code is in the new "try_to_follow_renames()" function. It really isn't rocket science: we notice that the pathname we were looking at went away, so we start a full tree diff and try to see if we can instead make that pathname be a rename or a copy from some other previous pathname. And if we can, we just continue, except we show *that* particular diff, and ever after we use the _previous_ pathname. One thing to look out for: the "rename detection" is considered to be a singular event in the _linear_ "git log" output! That's what people want to do, but I just wanted to point out that this patch is *not* carrying around a "commit,pathname" kind of pair and it's *not* going to be able to notice the file coming from multiple *different* files in earlier history. IOW, if you use "git log --follow", then you get the stupid CVS/SVN kind of "files have single identities" kind of semantics, and git log will just pick the identity based on the normal move/copy heuristics _as_if_ the history could be linearized. Put another way: I think the model is broken, but given the broken model, I think this patch does just about as well as you can do. If you have merges with the same "file" having different filenames over the two branches, git will just end up picking _one_ of the pathnames at the point where the newer one goes away. It never looks at multiple pathnames in parallel. And if you understood all that, you probably didn't need it explained, and if you didn't understand the above blathering, it doesn't really mtter to you. What matters to you is that you can now do git log -p --follow builtin-rev-list.c and it will find the point where the old "rev-list.c" got renamed to "builtin-rev-list.c" and show it as such. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jc/oneline'Junio C Hamano2007-06-221-2/+2
|\ | | | | | | | | * jc/oneline: pp_header(): work around possible memory corruption
| * pp_header(): work around possible memory corruptionJohannes Schindelin2007-06-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | add_user_info() possibly adds way more than just the commit header line. In fact, it sometimes needs so much more space that there is a buffer overrun, leading to an ugly crash. For example, the date is printed in its own line, and usually takes up more space than the equivalent Unix epoch. So, for good measure, add 80 characters (a full line) to the allocated space, in addition to the header line length. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ei/oneline+add-empty'Junio C Hamano2007-06-2213-239/+410
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | * ei/oneline+add-empty: Fix ALLOC_GROW calls with obsolete semantics Fix ALLOC_GROW off-by-one builtin-add: simplify (and increase accuracy of) exclude handling dir_struct: add collect_ignored option Extend --pretty=oneline to cover the first paragraph, Lift 16kB limit of log message output
| * | Fix ALLOC_GROW calls with obsolete semanticsJeff King2007-06-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | ALLOC_GROW now expects the 'nr' argument to be "how much you want" and not "how much you have". This fixes all cases where we weren't previously adding anything to the 'nr'. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Merge branch 'jk/add-empty' into ei/oneline+add-emptyJunio C Hamano2007-06-163-53/+51
| |\ \ | | |/ | |/| | | | | | | | | | * jk/add-empty: builtin-add: simplify (and increase accuracy of) exclude handling dir_struct: add collect_ignored option
| | * builtin-add: simplify (and increase accuracy of) exclude handlingJeff King2007-06-133-53/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the code would always set up the excludes, and then manually pick through the pathspec we were given, assuming that non-added but existing paths were just ignored. This was mostly correct, but would erroneously mark a totally empty directory as 'ignored'. Instead, we now use the collect_ignored option of dir_struct, which unambiguously tells us whether a path was ignored. This simplifies the code, and means empty directories are now just not mentioned at all. Furthermore, we now conditionally ask dir_struct to respect excludes, depending on whether the '-f' flag has been set. This means we don't have to pick through the result, checking for an 'ignored' flag; ignored entries were either added or not in the first place. We can safely get rid of the special 'ignored' flags to dir_entry, which were not used anywhere else. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | * dir_struct: add collect_ignored optionJeff King2007-06-132-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When set, this option will cause read_directory to keep track of which entries were ignored. While this shouldn't effect functionality in most cases, it can make warning messages to the user much more useful. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Fix ALLOC_GROW off-by-oneJeff King2007-06-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ALLOC_GROW macro will never let us fill the array completely, instead allocating an extra chunk if that would be the case. This is because the 'nr' argument was originally treated as "how much we do have now" instead of "how much do we want". The latter makes much more sense because you can grow by more than one item. This off-by-one never resulted in an error because it meant we were overly conservative about when to allocate. Any callers which passed "how much we have now" need to be updated, or they will fail to allocate enough. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Extend --pretty=oneline to cover the first paragraph,Junio C Hamano2007-06-132-135/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | so that an ugly commit message like this can be handled sanely. Currently, --pretty=oneline and --pretty=email (hence format-patch) take and use only the first line of the commit log message. This changes them to: - Take the first paragraph, where the definition of the first paragraph is "skip all blank lines from the beginning, and then grab everything up to the next empty line". - Replace all line breaks with a whitespace. This change would not affect a well-behaved commit message that adheres to the convention of "single line summary, a blank line, and then body of message", as its first paragraph always consists of a single line. Commit messages from different culture, such as the ones imported from CVS/SVN, can however get chomped with the existing behaviour at the first linebreak in the middle of sentence right now, which would become much easier to see with this change. The Subject: and --pretty=oneline output would become very long and unsightly for non-conforming commits, but their messages are already ugly anyway, and thischange at least avoids the loss of information. The Subject: line from a multi-line paragraph is folded using RFC2822 line folding rules at the places where line breaks were in the original. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Lift 16kB limit of log message outputJunio C Hamano2007-06-139-74/+124
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Traditionally we had 16kB limit when formatting log messages for output, because it was easier to arrange for the caller to have a reasonably big buffer and pass it down without ever worrying about reallocating. This changes the calling convention of pretty_print_commit() to lift this limit. Instead of the buffer and remaining length, it now takes a pointer to the pointer that points at the allocated buffer, and another pointer to the location that stores the allocated length, and reallocates the buffer as necessary. To support the user format, the error return of interpolate() needed to be changed. It used to return a bool telling "Ok the result fits", or "Sorry, I had to truncate it". Now it returns 0 on success, and returns the size of the buffer it wants in order to fit the whole result. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | filter-branch: add example to move everything into a subdirectoryJohannes Schindelin2007-06-222-0/+16
| | | | | | | | | | | | | | | | | | This is based on Jeff King's example in 20070621130137.GB4487@coredump.intra.peff.net Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'js/filter'Junio C Hamano2007-06-223-1/+537
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * js/filter: filter-branch: subdirectory filter needs --full-history filter-branch: Simplify parent computation. Teach filter-branch about subdirectory filtering filter-branch: also don't fail in map() if a commit cannot be mapped filter-branch: Use rev-list arguments to specify revision ranges. filter-branch: fix behaviour of '-k' filter-branch: use $(($i+1)) instead of $((i+1)) chmod +x git-filter-branch.sh filter-branch: prevent filters from reading from stdin t7003: make test repeatable Add git-filter-branch
| * | filter-branch: subdirectory filter needs --full-historyJohannes Sixt2007-06-092-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When two branches are merged that modify a subdirectory (possibly in different intermediate steps) such that both end up identical, then rev-list chooses only one branch. But when we filter history, we want to keep both branches. Therefore, we must use --full-history. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | filter-branch: Simplify parent computation.Johannes Sixt2007-06-091-17/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | We can use git rev-list --parents when we list the commits to rewrite. It is not necessary to run git rev-list --parents for each commit in the loop. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Teach filter-branch about subdirectory filteringJohannes Schindelin2007-06-092-3/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With git-filter-branch --subdirectory-filter <subdirectory> you can get at the history, as seen by a certain subdirectory. The history of the rewritten branch will only contain commits that touched that subdirectory, and the subdirectory will be rewritten to be the new project root. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | filter-branch: also don't fail in map() if a commit cannot be mappedJohannes Sixt2007-06-061-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The map() function can be used by filters to map a commit id to its rewritten id. Such a mapping may not exist, in which case the identity mapping is used (the commit is returned unchanged). In the rewrite loop, this mapping is also needed, but was done explicitly in the same way. Use the map() function instead. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | filter-branch: Use rev-list arguments to specify revision ranges.Johannes Sixt2007-06-062-28/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A subset of commits in a branch used to be specified by options (-k, -r) as well as the branch tip itself (-s). It is more natural (for git users) to specify revision ranges like 'master..next' instead. This makes it so. If no range is specified it defaults to 'HEAD'. As a consequence, the new name of the filtered branch must be the first non-option argument. All remaining arguments are passed to 'git rev-list' unmodified. The tip of the branch that gets filtered is implied: It is the first commit that git rev-list would print for the specified range. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | filter-branch: fix behaviour of '-k'Johannes Schindelin2007-06-062-12/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The option '-k' says that the given commit and _all_ of its ancestors are kept as-is. However, if a to-be-rewritten commit branched from an ancestor of an ancestor of a commit given with '-k', filter-branch would fail. Example: A - B \ C If filter-branch was called with '-k B -s C', it would actually keep B (and A as its parent), but would rewrite C, and its parent. Noticed by Johannes Sixt. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | filter-branch: use $(($i+1)) instead of $((i+1))Johannes Schindelin2007-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The expression $((i+1)) is not portable at all: even some bash versions do not grok it. So do not use it. Noticed by Jonas Fonseca. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | chmod +x git-filter-branch.shMatthias Lederhofer2007-06-061-0/+0
| | | | | | | | | | | | | | | Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | filter-branch: prevent filters from reading from stdinMatthias Lederhofer2007-06-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stdin is the list of commits when the env, tree and index filter are executed. The filters are not supposed to read anything from stdin so the best is to give them /dev/null for reading. Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | t7003: make test repeatableJunio C Hamano2007-06-051-0/+1
| | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Add git-filter-branchJohannes Schindelin2007-06-023-1/+479
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This script is derived from Pasky's cg-admin-rewritehist. In fact, it _is_ the same script, minimally adapted to work without cogito. It _should_ be able to perform the same tasks, even if only relying on core-git programs. All the work is Pasky's, just the adaption is mine. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Hopefully-signed-off-by: Petr "cogito master" Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | | Two trivial -Wcast-qual fixesJunio C Hamano2007-06-222-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Luiz Fernando N. Capitulino noticed the one in tree-walk.h where we cast away constness while computing the legnth of a tree entry. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | diffcore-rename: favour identical basenamesJohannes Schindelin2007-06-222-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When there are several candidates for a rename source, and one of them has an identical basename to the rename target, take that one. Noticed by Govind Salinas, posted by Shawn O. Pearce, partial patch by Linus Torvalds. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Document git-gui, git-citool as mainporcelain manual pagesShawn O. Pearce2007-06-224-5/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jakub Narebski pointed out that the git-gui blame viewer is not a widely known feature, but is incredibly useful. Part of the issue is advertising. Up until now we haven't even referenced git-gui from within the core Git manual pages, mostly because I just wasn't sure how I wanted to supply git-gui documentation to end-users, or how that documentation should integrate with the core Git documentation. Based upon Jakub's comment that many users may not even know that the gui is available in a stock Git distribution I'm offering up two basic manual pages: git-citool and git-gui. These should offer enough of a starting point for users to identify that the gui exists, and how to start it. Future releases of git-gui may contain their own documentation system available from within a running git-gui. But not today. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Generate tags with correct timestamp (git-svnimport)Dave O'Neill2007-06-222-24/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now uses git-tag instead of manually constructing the tag. This gives us a correct timestamp, removes some crufty code, and makes it work the same as git-cvsimport. The generated tags are now lightweight tags instead of tag objects, which may or may not be the behaviour we want. Also, remove two unused variables from git-cvsimport. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Cloning from a repo without "current branch"Nanako Shiraishi2007-06-201-7/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the remote repository does not have a "current branch", git-clone was confused and did not set up the resulting new repository correctly. It did not reset HEAD from the default 'master', and did not write the SHA1 to the master branch. Signed-off-by: Nanako Shiraishi <nanako3@bluebottle.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Change default man page path to /usr/share/manIsmail Dönmez2007-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to FHS, http://www.pathname.com/fhs/pub/fhs-2.3.html#USRSHAREMANMANUALPAGES default man page path is $prefix/share/man. Signed-off-by: Ismail Donmez <ismail@pardus.org.tr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | INSTALL: explain how to build documentationJunio C Hamano2007-06-201-4/+10
| | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | cvsserver: Actually implement --export-allAlex Riesen2007-06-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Frank Lichtenheld, Fri, Jun 15, 2007 03:01:53 +0200: > +test_expect_failure 'req_Root failure (export-all w/o whitelist)' \ > + 'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 > + || false' This does not work, at least for bash in current Ubuntu: GNU bash, version 3.2.13(1)-release You have to put "||" on the previous line: Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Document git log --full-diffJakub Narebski2007-06-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Based on description of commit 477f2b41310c4b1040a9e7f72720b9c39d82caf9 "git log --full-diff" adding this option. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Document git log --abbrev-commit, as a kind of pretty optionJakub Narebski2007-06-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Documentation taken from paraphrased description of "--abbrev[=<n>]" diff option, and from description of commit 5c51c985 introducing this option. Note that to change number of digits one must use "--abbrev=<n>", which affects [also] diff output. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Use tabs for indenting definition list for options in git-log.txtJakub Narebski2007-06-161-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Document git rev-list --timestampJakub Narebski2007-06-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that git log does not understand this option yet: $ git log --timestamp fatal: unrecognized argument: --timestamp Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Document git reflog --stale-fixJakub Narebski2007-06-161-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Document --stale-fix, used in "git reflog expire --stale-fix --all" to remove invalid reflog entries, to fix situation after running non reflog-aware git-prune from an older git in the presence of reflogs (see RelNotes-1.5.0.txt). Based on description of commit 1389d9ddaa68a4cbf5018d88f971b9bbb7aaa3c9 "reflog expire --fix-stale" which introduced this option. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Document git rev-parse --is-inside-git-dirJakub Narebski2007-06-161-0/+4
| | | | | | | | | | | | | | | Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Document git read-tree --trivialJakub Narebski2007-06-162-2/+8
| | | | | | | | | | | | | | | Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Document git rev-list --full-historyJakub Narebski2007-06-161-0/+9
| | | | | | | | | | | | | | | Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Do not use h_errno after connect(2): the function does not set itAlex Riesen2007-06-161-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Randal L. Schwartz noticed compilation problems on SunOS, which made me look at the code again. The thing is, h_errno is not used by connect(2), it is only for functions from netdb.h, like gethostbyname. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Documentation: update "stale" links for 1.5.2.2Junio C Hamano2007-06-161-1/+3
| | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/remote'Junio C Hamano2007-06-163-85/+275
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jc/remote: git-push: Update description of refspecs and add examples remote.c: "git-push frotz" should update what matches at the source. remote.c: fix "git push" weak match disambiguation remote.c: minor clean-up of match_explicit() remote.c: refactor creation of new dst ref remote.c: refactor match_explicit_refs()
| * | | git-push: Update description of refspecs and add examplesJunio C Hamano2007-06-091-3/+22
| | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | remote.c: "git-push frotz" should update what matches at the source.Junio C Hamano2007-06-092-6/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Earlier, when the local repository has a branch "frotz" and the remote repository has a tag "frotz" (but not branch "frotz"), "git-push frotz" mistakenly updated the tag at the remote side. This was because the partial refname matching code was applied independently on both source and destination side. With this fix, when a colon-less refspec is given to git-push, we first match it with the refs in the source repository, and update the matching ref in the destination repository. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | remote.c: fix "git push" weak match disambiguationJunio C Hamano2007-06-092-1/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When "git push A:B" is given, and A (or B) is not a full refname that begins with refs/, we require an unambiguous match with an existing ref. For this purpose, a match with a local branch or a tag (i.e. refs/heads/A and refs/tags/A) is called a "strong match", and any other match is called a "weak match". A partial refname is unambiguous when there is only one strong match with any number of weak matches, or when there is only one weak match and no other match. However, as reported by Sparse with Ramsay Jones recently, count_refspec_match() function had a bug where a variable in an inner block masked a different variable of the same name, which caused the weak matches to be ignored. This fixes it, and adds tests for the fix. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | remote.c: minor clean-up of match_explicit()Junio C Hamano2007-06-091-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When checking what ref the source refspec matches, we have no business setting the default for the destination, so move that code lower. Also simplify the result from the code block that matches the source side by making it set matched_src only upon unambiguous match. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | remote.c: refactor creation of new dst refJunio C Hamano2007-06-091-18/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This refactors open-coded sequence to create a new "struct ref" and link it to the tail of dst list into a new function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | remote.c: refactor match_explicit_refs()Junio C Hamano2007-06-091-73/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This does not change functionality; just splits one block that is deeply nested and indented out of a huge loop into a separate function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'gp/branch'Junio C Hamano2007-06-162-2/+16
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | * gp/branch: git-branch: cleanup config file when deleting branches