Resolve_relative_url was using its own code for this function, but
this is duplication with the best result that this continues to work.
Replace with the common function provided by git-parse-remote.
Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
unpack_trees(): protect the handcrafted in-core index from read_cache()
git-p4: Fix one-liner in p4_write_pipe function.
Completion: add missing '=' for 'diff --diff-filter'
Fix 'git help help'
unpack_trees() rebuilds the in-core index from scratch by allocating a new
structure and finishing it off by copying the built one to the final
index.
The resulting in-core index is Ok for most use, but read_cache() does not
recognize it as such. The function is meant to be no-op if you already
have loaded the index, until you call discard_cache().
This change the way read_cache() detects an already initialized in-core
index, by introducing an extra bit, and marks the handcrafted in-core
index as initialized, to avoid this problem.
A better fix in the longer term would be to change the read_cache() API so
that it will always discard and re-read from the on-disk index to avoid
confusion. But there are higher level API that have relied on the current
semantics, and they and their users all need to get converted, which is
outside the scope of 'maint' track.
An example of such a higher level API is write_cache_as_tree(), which is
used by git-write-tree as well as later Porcelains like git-merge, revert
and cherry-pick. In the longer term, we should remove read_cache() from
there and add one to cmd_write_tree(); other callers expect that the
in-core index they prepared is what gets written as a tree so no other
change is necessary for this particular codepath.
The original version of this patch marked the index by pointing an
otherwise wasted malloc'ed memory with o->result.alloc, but this version
uses Linus's idea to use a new "initialized" bit, which is conceptually
much cleaner.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The function built a p4 command string via the p4_build_cmd function, but
ignored the result.
Signed-off-by: Tor Arvid Lund <torarvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Several call sites in git-submodule.sh used the same idiom for getting
submodule information:
git ls-files --stage -- "$@" | grep '^160000 '
This patch removes this duplication by introducing a module_list function.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The code handles additionally "refs/remotes/<something>/name",
"remotes/<something>/name", and "refs/<namespace>/name".
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
During a conflicting merge, you would typically see:
Auto-merged foo.txt
CONFLICT (content): Merge conflict in foo.txt
Recorded preimage for 'foo.txt'
Automatic merge failed; fix conflicts and then commit the result.
and left wondering what happened to "foo.txt". Did it succeed, and then
conflicted, and then what?
This is because historically there was a progress bar displayed before the
auto-merge is mentioned, and it was expected to take long time, before we
can say "Auto-merged foo.txt". It turns out it was not the case, and the
original wording "Auto-merging foo.txt" we used to have before 89f40be
(Convert output messages in merge-recursive to past tense., 2007-01-14) is
better.
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The native install on some platforms (namely IRIX 6.5) treats non-absolute
paths as being relative to the root directory rather than relative to
the current directory. Work around this by avoiding install in this case
since it is unnecessary, and instead depend on the local umask setting
and use mkdir.
Tested-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
A number of call sites allocate memory for a refspec array, populate
its members with heap memory, and then free only the refspec pointer
while leaking the memory allocated for the member elements. Provide
a function for freeing the elements of a refspec array and the array
itself.
Caution to callers: code paths must be checked to ensure that the
refspec members "src" and "dst" can be passed to free.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The tag rewriting code used a 'sed' expression to substitute the new tag
name into the corresponding field of the annotated tag object. But this is
problematic if the tag name contains special characters. In particular,
if the tag name contained a slash, then the 'sed' expression had a syntax
error. We now protect against this by using 'printf' to assemble the
tag header.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Sometimes you want to keep the trash directory, even if all tests
passed. For example, when extending tests, it comes it quite handy.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
A squash merge into an unborn branch could be implemented by building the
index from the merged-from branch, and doing a single commit, but this is
not supported yet.
A non-fast-forward merge into an unborn branch does not make any sense,
because you cannot make a merge commit if you don't have a commit to use
as the parent.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
As we support seconds-since-epoch in $GIT_COMMITTER_TIME we should
also support it in a reflog @{...} style notation. We can easily
tell this part from @{nth} style notation by looking to see if the
value is unreasonably large for an @{nth} style notation.
The value 100000000 was chosen as it is already used by date.c to
disambiguate yyyymmdd format from a seconds-since-epoch time value.
A reflog with 100,000,000 record entries is also simply not valid.
Such a reflog would require at least 7.7 GB to store just the old
and new SHA-1 values. So our randomly chosen upper limit for @{nth}
notation is "big enough".
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The configure script allows you to specify flags to pass to the linker
step in the LDFLAGS environment variable but this was being ignored in
the Makefile. Now a make variable gets set to the value passed down
from the configure script.
Signed-off-by: Neil Roberts <bpeeluk@yahoo.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git help foo invokes man git-foo if foo is a git command, otherwise it
invokes man gitfoo. 'help' is not a git command, but the manual page is
called git-help, so add this special exception.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
compat/snprintf.c: handle snprintf's that always return the # chars transmitted
git-svn: fix dcommit to urls with embedded usernames
revision.h: make show_early_output an extern which is defined in revision.c
Some platforms provide a horribly broken snprintf. More broken than the
platforms that return -1 when there is too little space in the target buffer
for the formatted string. Some platforms provide an snprintf which _always_
returns the number of characters transmitted to the buffer, regardless of
whether there was enough space or not.
IRIX 6.5 is such a platform. IRIX does have a working snprintf(), but it
is only provided when _NO_XOPEN5 evaluates to zero, and this only happens
if _XOPEN_SOURCE is defined, but definition of _XOPEN_SOURCE prevents
inclusion of many other common functions and defines. So it must be avoided.
Work around these horribly broken snprintf implementations by detecting an
snprintf call which results in the number of transmitted characters exactly
equal to the length of our buffer and retrying with a larger buffer just to
be safe.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Find lines with <h1>..<h6> tags.
[jc: while at it, reordered entries to sort alphabetically.]
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Don't rely on the extracted URL from working_head_info since that has the
username removed. Instead use the $gs->full_url method (as before with
ba24e74 (git-svn: add ability to specify --commit-url for dcommit,
2008-08-07)) to give us the URL to commit to if --commit-url is not
specified.
Aditionally, since we clean usernames from URLs, checking the URL after
rebase can fail because it doesn't match the URL we used to commit; so
unconditionally provide a username-free URL for checking the result of the
refetch.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* kh/diff-tree:
Add test for diff-tree --stdin with two trees
Teach git diff-tree --stdin to diff trees
diff-tree: Note that the commit ID is printed with --stdin
Refactoring: Split up diff_tree_stdin
* cc/merge-base-many:
git-merge-octopus: use (merge-base A (merge B C D E...)) for stepwise merge
merge-base-many: add trivial tests based on the documentation
documentation: merge-base: explain "git merge-base" with more than 2 args
merge-base: teach "git merge-base" to drive underlying merge_bases_many()
The variable show_early_output is defined in revision.c and should be
declared extern in revision.h so that the linker does not complain
about multiply defined variables.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
Update draft release notes for 1.6.0.1
Add hints to revert documentation about other ways to undo changes
Install templates with the user and group of the installing personality
"git-merge": allow fast-forwarding in a stat-dirty tree
completion: find out supported merge strategies correctly
decorate: allow const objects to be decorated
for-each-ref: cope with tags with incomplete lines
diff --check: do not get confused by new blank lines in the middle
remote.c: remove useless if-before-free test
mailinfo: avoid violating strbuf assertion
git format-patch: avoid underrun when format.headers is empty or all NLs
Based on its name, people may read the 'git revert' documentation when
they want to undo local changes, especially people who have used other
SCM's. 'git revert' may not be what they had in mind, but git
provides several other ways to undo changes to files. We can help
them by pointing them towards the git commands that do what they might
want to do.
Cc: Daniel Barkalow <barkalow@iabervon.org>
Cc: Lea Wiemann <lewiemann@gmail.com>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
If 'make install' was run with sufficient privileges, then the installed
templates, which are copied using 'tar', would receive the user and group
of whoever built git. This instructs 'tar' to ignore the user and group
that are recorded in the archive.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We used to refresh the index to clear stat-dirtyness before a fast-forward
merge. Recent C rewrite forgot to do this.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
"git-merge" is a binary executable these days, and looking for assignment
to $all_strategies variable with grep/sed does not work well.
When asked for an unknown strategy, pre-1.6.0 and post-1.6.0 "git merge"
commands respectively say:
$ $HOME/git-snap-v1.5.6.5/bin/git merge -s help
available strategies are: recur recursive octopus resolve stupid ours subtree
$ $HOME/git-snap-v1.6.0/bin/git merge -s help
Could not find merge strategy 'help'.
Available strategies are: recursive octopus resolve ours subtree.
both on their standard error stream. We can use this to learn what
strategies are supported.
The sed script is written in such a way that it catches both old and new
message styles ("Available" vs "available", and the full stop at the end).
It also allows future versions of "git merge" to line-wrap the list of
strategies, and add extra comments, like this:
$ $HOME/git-snap-v1.6.1/bin/git merge -s help
Could not find merge strategy 'help'.
Available strategies are: blame recursive octopus resolve ours
subtree.
Also you have custom strategies: theirs
Make sure you spell strategy names correctly.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
We don't actually modify the struct object, so there is no
reason not to accept const versions (and this allows other
callsites, like the next patch, to use the decoration
machinery).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
If you have a tag with a single, incomplete line as its payload, asking
git-for-each-ref for its %(body) element accessed a NULL pointer.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The code remembered that the last diff output it saw was an empty line,
and tried to reset that state whenever it sees a context line, a non-blank
new line, or a new hunk. However, this codepath asks the underlying diff
engine to feed diff without any context, and the "just saw an empty line"
state was not reset if you added a new blank line in the last hunk of your
patch, even if it is not the last line of the file.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* bd/diff-strbuf:
xdiff-interface: hide the whole "xdiff_emit_state" business from the caller
Use strbuf for struct xdiff_emit_state's remainder
Make xdi_diff_outf interface for running xdiff_outf diffs
* dp/hash-literally:
add --no-filters option to git hash-object
add --path option to git hash-object
use parse_options() in git hash-object
correct usage help string for git-hash-object
correct argument checking test for git hash-object
teach index_fd to work with pipes