summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-06-26git-checkout: disallow --detach on unborn branchChris Webb
abe199808c (git checkout -b: allow switching out of an unborn branch) introduced a bug demonstrated by git checkout --orphan foo git checkout --detach git symbolic-ref HEAD which gives 'refs/heads/(null)'. This happens because we strbuf_addf(&branch_ref, "refs/heads/%s", opts->new_branch) when opts->new_branch can be NULL for --detach. Catch and forbid this case, adding a test to t2017 to catch it in future. Signed-off-by: Chris Webb <chris@arachsys.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-07git checkout -b: allow switching out of an unborn branchJunio C Hamano
Running "git checkout -b another" immediately after "git init" when you do not even have a commit on 'master' fails with: $ git checkout -b another fatal: You are on a branch yet to be born This is unnecessary, if we redefine "git checkout -b $name" that does not take any $start_point (which has to be a commit) as "I want to check out a new branch $name from the state I am in". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-13Update draft release notes to 1.7.6.6Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-13thin-pack: try harder to use preferred base objects as baseJeff King
When creating a pack using objects that reside in existing packs, we try to avoid recomputing futile delta between an object (trg) and a candidate for its base object (src) if they are stored in the same packfile, and trg is not recorded as a delta already. This heuristics makes sense because it is likely that we tried to express trg as a delta based on src but it did not produce a good delta when we created the existing pack. As the pack heuristics prefer producing delta to remove data, and Linus's law dictates that the size of a file grows over time, we tend to record the newest version of the file as inflated, and older ones as delta against it. When creating a thin-pack to transfer recent history, it is likely that we will try to send an object that is recorded in full, as it is newer. But the heuristics to avoid recomputing futile delta effectively forbids us from attempting to express such an object as a delta based on another object. Sending an object in full is often more expensive than sending a suboptimal delta based on other objects, and it is even more so if we could use an object we know the receiving end already has (i.e. preferred base object) as the delta base. Tweak the recomputation avoidance logic, so that we do not punt on computing delta against a preferred base object. The effect of this change can be seen on two simulated upload-pack workloads. The first is based on 44 reflog entries from my git.git origin/master reflog, and represents the packs that kernel.org sent me git updates for the past month or two. The second workload represents much larger fetches, going from git's v1.0.0 tag to v1.1.0, then v1.1.0 to v1.2.0, and so on. The table below shows the average generated pack size and the average CPU time consumed for each dataset, both before and after the patch: dataset | reflog | tags --------------------------------- before | 53358 | 2750977 size after | 32398 | 2668479 change | -39% | -3% --------------------------------- before | 0.18 | 1.12 CPU after | 0.18 | 1.15 change | +0% | +3% This patch makes a much bigger difference for packs with a shorter slice of history (since its effect is seen at the boundaries of the pack) though it has some benefit even for larger packs. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-12attr: fix leak in free_attr_elemJeff King
This function frees the individual "struct match_attr"s we have allocated, but forgot to free the array holding their pointers, leading to a minor memory leak (but it can add up after checking attributes for paths in many directories). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-11t2203: fix wrong commit commandNguyễn Thái Ngọc Duy
Add commit message to avoid commit's aborting due to the lack of commit message, not because there are INTENT_TO_ADD entries in index. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10Prepare for 1.7.6.6Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10Documentation: rerere's rr-cache auto-creation and rerere.enabledJunio C Hamano
The description of rerere.enabled left the user in the dark as to who might create an rr-cache directory. Add a note that simply invoking rerere does this. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10attr.c: clarify the logic to pop attr_stackJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10attr.c: make bootstrap_attr_stack() leave earlyJunio C Hamano
Thas would de-dent the body of a function that has grown rather large over time, making it a bit easier to read. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10attr: drop misguided defensive codingJeff King
In prepare_attr_stack, we pop the old elements of the stack (which were left from a previous lookup and may or may not be useful to us). Our loop to do so checks that we never reach the top of the stack. However, the code immediately afterwards will segfault if we did actually reach the top of the stack. Fortunately, this is not an actual bug, since we will never pop all of the stack elements (we will always keep the root gitattributes, as well as the builtin ones). So the extra check in the loop condition simply clutters the code and makes the intent less clear. Let's get rid of it. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-10attr: don't confuse prefixes with leading directoriesJeff King
When we prepare the attribute stack for a lookup on a path, we start with the cached stack from the previous lookup (because it is common to do several lookups in the same directory hierarchy). So the first thing we must do in preparing the stack is to pop any entries that point to directories we are no longer interested in. For example, if our stack contains gitattributes for: foo/bar/baz foo/bar foo but we want to do a lookup in "foo/bar/bleep", then we want to pop the top element, but retain the others. To do this we walk down the stack from the top, popping elements that do not match our lookup directory. However, the test do this simply checked strncmp, meaning we would mistake "foo/bar/baz" as a leading directory of "foo/bar/baz_plus". We must also check that the character after our match is '/', meaning we matched the whole path component. There are two special cases to consider: 1. The top of our attr stack has the empty path. So we must not check for '/', but rather special-case the empty path, which always matches. 2. Typically when matching paths in this way, you would also need to check for a full string match (i.e., the character after is '\0'). We don't need to do so in this case, though, because our path string is actually just the directory component of the path to a file (i.e., we know that it terminates with "/", because the filename comes after that). Helped-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-06Documentation: rerere.enabled is the primary way to configure rerereThomas Rast
The wording seems to suggest that creating the directory is needed and the setting of rerere.enabled is only for disabling the feature by setting it to 'false'. But the configuration is meant to be the primary control and setting it to 'true' will enable it; the rr-cache directory will be created as necessary and the user does not have to create it. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-01Documentation: read-tree --prefix works with existing subtreesClemens Buchacher
Since 34110cd4 (Make 'unpack_trees()' have a separate source and destination index) it is no longer true that a subdirectory with the same prefix must not exist. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-29Add MYMETA.json to perl/.gitignoreJack Nagel
ExtUtils::MakeMaker generates MYMETA.json in addition to MYMETA.yml since version 6.57_07. As it suggests, it is just meta information about the build and is cleaned up with 'make clean', so it should be ignored. Signed-off-by: Jack Nagel <jacknagel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-14Git 1.7.6.5v1.7.6.5Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-14Merge branch 'jk/maint-fetch-status-table' into maint-1.7.6Junio C Hamano
* jk/maint-fetch-status-table: fetch: create status table using strbuf
2011-12-14Merge branch 'jc/maint-name-rev-all' into maint-1.7.6Junio C Hamano
* jc/maint-name-rev-all: name-rev --all: do not even attempt to describe non-commit object
2011-12-14Merge branch 'ml/mailmap' into maint-1.7.6Junio C Hamano
* ml/mailmap: mailmap: xcalloc mailmap_info Conflicts: mailmap.c
2011-12-14blame: don't overflow time bufferJeff King
When showing the raw timestamp, we format the numeric seconds-since-epoch into a buffer, followed by the timezone string. This string has come straight from the commit object. A well-formed object should have a timezone string of only a few bytes, but we could be operating on data pushed by a malicious user. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-10fetch: create status table using strbufJeff King
When we fetch from a remote, we print a status table like: From url * [new branch] foo -> origin/foo We create this table in a static buffer using sprintf. If the remote refnames are long, they can overflow this buffer and smash the stack. Instead, let's use a strbuf to build the string. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-05stripspace: fix outdated commentJeff King
The comment on top of stripspace() claims that the buffer will no longer be NUL-terminated. However, this has not been the case at least since the move to using strbuf in 2007. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-05Add MYMETA.yml to perl/.gitignoreSebastian Morr
This file is auto-generated by newer versions of ExtUtils::MakeMaker (presumably starting with the version shipping with Perl 5.14). It just contains extra information about the environment and arguments to the Makefile-building process, and should be ignored. Signed-off-by: Sebastian Morr <sebastian@morr.cc> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-17mailmap: xcalloc mailmap_infoMarc-André Lureau
This is to avoid reaching free of uninitialized members. With an invalid .mailmap (and perhaps in other cases), it can reach free(mi->name) with garbage for example. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-15name-rev --all: do not even attempt to describe non-commit objectJunio C Hamano
This even dates back to the very beginning of "git name-rev"; it does not make much sense to dump all objects in the repository and label non-commits as "undefined". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-26Merge branch 'mh/maint-notes-merge-pathbuf-fix' into maint-1.7.6Junio C Hamano
* mh/maint-notes-merge-pathbuf-fix: notes_merge_commit(): do not pass temporary buffer to other function
2011-10-26Merge branch 'ps/gitweb-js-with-lineno' into maint-1.7.6Junio C Hamano
* ps/gitweb-js-with-lineno: gitweb: Fix links to lines in blobs when javascript-actions are enabled
2011-10-26Merge branch 'jm/mergetool-pathspec' into maint-1.7.6Junio C Hamano
* jm/mergetool-pathspec: mergetool: no longer need to save standard input mergetool: Use args as pathspec to unmerged files
2011-10-26Merge branch 'mz/remote-rename' into maint-1.7.6Junio C Hamano
* mz/remote-rename: remote: only update remote-tracking branch if updating refspec remote rename: warn when refspec was not updated remote: "rename o foo" should not rename ref "origin/bar" remote: write correct fetch spec when renaming remote 'remote'
2011-10-26Merge branch 'rj/maint-t9159-svn-rev-notation' into maint-1.7.6Junio C Hamano
* rj/maint-t9159-svn-rev-notation: t9159-*.sh: skip for mergeinfo test for svn <= 1.4
2011-10-26Merge branch 'hl/iso8601-more-zone-formats' into maint-1.7.6Junio C Hamano
* hl/iso8601-more-zone-formats: date.c: Support iso8601 timezone formats
2011-10-26Merge branch 'tr/doc-note-rewrite' into maint-1.7.6Junio C Hamano
* tr/doc-note-rewrite: Documentation: basic configuration of notes.rewriteRef
2011-10-26Merge branch 'nd/sparse-doc' into maint-1.7.6Junio C Hamano
* nd/sparse-doc: git-read-tree.txt: update sparse checkout examples
2011-10-26Merge branch 'mg/maint-doc-sparse-checkout' into maint-1.7.6Junio C Hamano
* mg/maint-doc-sparse-checkout: git-read-tree.txt: correct sparse-checkout and skip-worktree description git-read-tree.txt: language and typography fixes unpack-trees: print "Aborting" to stderr
2011-10-26Merge branch 'maint-1.7.5' into maint-1.7.6Junio C Hamano
* maint-1.7.5: make the sample pre-commit hook script reject names with newlines, too Reindent closing bracket using tab instead of spaces Documentation/git-update-index: refer to 'ls-files'
2011-10-26Merge branch 'maint-1.7.4' into maint-1.7.5Junio C Hamano
* maint-1.7.4: make the sample pre-commit hook script reject names with newlines, too Reindent closing bracket using tab instead of spaces Documentation/git-update-index: refer to 'ls-files'
2011-10-26Merge branch 'maint-1.7.3' into maint-1.7.4Junio C Hamano
* maint-1.7.3: make the sample pre-commit hook script reject names with newlines, too Reindent closing bracket using tab instead of spaces Documentation/git-update-index: refer to 'ls-files'
2011-10-26Merge branch 'sn/doc-update-index-assume-unchanged' into maint-1.7.3Junio C Hamano
* sn/doc-update-index-assume-unchanged: Documentation/git-update-index: refer to 'ls-files'
2011-10-26make the sample pre-commit hook script reject names with newlines, tooJim Meyering
The sample pre-commit hook script would fail to reject a file name like "a\nb" because of the way newlines are handled in "$(...)". Adjust the test to count filtered bytes and require there be 0. Also print all diagnostics to standard error, not stdout, so they will actually be seen. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-24Reindent closing bracket using tab instead of spacesNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-27notes_merge_commit(): do not pass temporary buffer to other functionMichael Haggerty
It is unsafe to pass a temporary buffer as an argument to read_directory(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Acked-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-27gitweb: Fix links to lines in blobs when javascript-actions are enabledPeter Stuge
The fixLinks() function adds 'js=1' to each link that does not already have 'js' query parameter specified. This is used to signal to gitweb that the browser can actually do javascript when these links are used. There are two problems with the existing code: 1. URIs with fragment and 'js' query parameter, like e.g. ...foo?js=0#l199 were not recognized as having 'js' query parameter already. 2. The 'js' query parameter, in the form of either '?js=1' or ';js=1' was appended at the end of URI, even if it included a fragment (had a hash part). This lead to the incorrect links like this ...foo#l199?js=1 instead of adding query parameter as last part of query, but before the fragment part, i.e. ...foo?js=1#l199 Signed-off-by: Peter Stuge <peter@stuge.se> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-26git-read-tree.txt: update sparse checkout examplesNguyễn Thái Ngọc Duy
The negation example uses '*' to match everything. This used to work before 9037026 (unpack-trees: fix sparse checkout's "unable to match directories") because back then, the list of paths is used to match sparse patterns, so with the patterns * !subdir/ subdir/ always matches any path that start with subdir/ and "*" has no chance to get tested. The result is subdir is excluded. After the said commit, a tree structure is dynamically created and sparse pattern matching now follows closely how read_directory() applies .gitignore. This solves one problem, but reveals another one. With this new strategy, "!subdir/" rule will be only tested once when "subdir" directory is examined. Entries inside subdir, when examined, will match "*" and are (correctly) re-added again because any rules without a slash will match at every directory level. In the end, "*" can revert every negation rules. In order to correctly exclude subdir, we must use /* !subdir to limit "match all" rule at top level only. "*" rule has no actual use in sparse checkout and can be confusing to users. While we can automatically turn "*" to "/*", this violates .gitignore definition. Instead, discourage "*" in favor of "/*" (in the second example). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-26mergetool: no longer need to save standard inputJunio C Hamano
Earlier code wanted to run merge_file and prompt_after_failed_merge both of which wanted to read from the standard input of the entire script inside a while loop, which read from a pipe, and in order to do so, it redirected the original standard input to another file descriptor. We no longer need to do so after the previous change. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-26mergetool: Use args as pathspec to unmerged filesJonathon Mah
Mergetool now treats its path arguments as a pathspec (like other git subcommands), restricting action to the given files and directories. Files matching the pathspec are filtered so mergetool only acts on unmerged paths; previously it would assume each path argument was in an unresolved state, and get confused when it couldn't check out their other stages. Running "git mergetool subdir" will prompt to resolve all conflicted blobs under subdir. Signed-off-by: Jonathon Mah <me@JonathonMah.com> Acked-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-23Git 1.7.6.4v1.7.6.4Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-23Merge branch 'cb/maint-ls-files-error-report' into maintJunio C Hamano
* cb/maint-ls-files-error-report: t3005: do not assume a particular order of stdout and stderr of git-ls-files ls-files: fix pathspec display on error
2011-09-23describe: Refresh the index when run with --dirtyAllan Caffee
When running git describe --dirty the index should be refreshed. Previously the cached index would cause describe to think that the index was dirty when, in reality, it was just stale. The issue was exposed by python setuptools which hardlinks files into another directory when building a distribution. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-23Merge branch 'jc/maint-clone-alternates' into maintJunio C Hamano
* jc/maint-clone-alternates: clone: clone from a repository with relative alternates clone: allow more than one --reference
2011-09-23Merge branch 'nd/maint-clone-gitdir' into maintJunio C Hamano
* nd/maint-clone-gitdir: clone: allow to clone from .git file read_gitfile_gently(): rename misnamed function to read_gitfile()