Walking forward through history (i.e., topologically earliest
commits first), we filter the parent list of every commit as
follows. Consider a parent P:
- If P touches any of the interesting line ranges, we keep it.
- If P is a merge and it takes all the interesting line ranges
from one of its parents, P is rewritten to this parent, else
we keep P.
- Otherwise, P is rewritten to its (only) parent P^.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The new t020[01] for gettext support did not find git-sh-i18n and the
translation data when run under --valgrind: lib-gettext.sh tried to
locate them under $GIT_EXEC_PATH, which normally is the git build
directory, but is changed by --valgrind to point to the wrappers.
Introduce a new variable $GIT_BUILD_DIR which can be used to locate
data that resides under the build directory, and use that instead.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* jl/submodule-ignore-diff:
Add tests for the diff.ignoreSubmodules config option
Add the 'diff.ignoreSubmodules' config setting
Submodules: Use "ignore" settings from .gitmodules too for diff and status
Submodules: Add the new "ignore" config option for diff and status
Conflicts:
diff.c
submodule.c
* mm/rebase-i-exec:
test-lib: user-friendly alternatives to test [-d|-f|-e]
rebase -i: add exec command to launch a shell command
Conflicts:
git-rebase--interactive.sh
* cc/find-commit-subject:
blame: use find_commit_subject() instead of custom code
merge-recursive: use find_commit_subject() instead of custom code
bisect: use find_commit_subject() instead of custom code
revert: rename variables related to subject in get_message()
revert: refactor code to find commit subject in find_commit_subject()
revert: fix off by one read when searching the end of a commit subject
* mm/shortopt-detached:
log: parse separate option for --glob
log: parse separate options like git log --grep foo
diff: parse separate options --stat-width n, --stat-name-width n
diff: split off a function for --stat-* option parsing
diff: parse separate options like -S foo
Conflicts:
revision.c
* nd/fix-sparse-checkout:
unpack-trees: mark new entries skip-worktree appropriately
unpack-trees: do not check for conflict entries too early
unpack-trees: let read-tree -u remove index entries outside sparse area
unpack-trees: only clear CE_UPDATE|CE_REMOVE when skip-worktree is always set
t1011 (sparse checkout): style nitpicks
* master:
push: mention "git pull" in error message for non-fast forwards
Standardize do { ... } while (0) style
t/t7003: replace \t with literal tab in sed expression
index-pack: Don't follow replace refs.
* bc/use-more-hardlinks-in-install:
Makefile: make hard/symbolic links for non-builtins too
Makefile: link builtins residing in bin directory to main git binary too
* tr/rfc-reset-doc:
Documentation/reset: move "undo permanently" example behind "make topic"
Documentation/reset: reorder examples to match description
Documentation/reset: promote 'examples' one section up
Documentation/reset: separate options by mode
Documentation/git-reset: reorder modes for soft-mixed-hard progression
* maint:
push: mention "git pull" in error message for non-fast forwards
Standardize do { ... } while (0) style
t/t7003: replace \t with literal tab in sed expression
index-pack: Don't follow replace refs.
The message remains fuzzy to include "git pull", "git pull --rebase" and
others, but directs the user to the simplest solution in the vast
majority of cases.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Remove the setlocale/LC_CTYPE call from gettext.c, we only need
setlocale/LC_MESSAGES to use the message catalog, and setting LC_CTYPE
from the environment breaks Git's assumptions about C library
functions.
Under a non-C locale functions like vsnprintf become locale sensitive,
so that they'll e.g. refuse to process ISO-8895-1 data under a UTF-8
locale.
This triggered a "your vsnprintf is broken" error on Git's own
repository when inspecting v0.99.6~1 under a UTF-8 locale.
That commit contains a ISO-8859-1 encoded author name, which the
locale aware vsnprintf(3) won't interpolate in the format argument,
due to mismatch between the data encoding and the locale.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The sed utilities on IRIX and Solaris do not interpret the sequence '\t'
to mean a tab character; they read a literal character 't'. So, use a
literal tab instead.
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Provide a 'list' command to view available bare repositories ending in
.git and a 'help command to display usage. Also add documentation in
a README
Signed-off-by: Greg Brockman <gdb@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This provides a mechanism for the server to expose custom
functionality to clients. My particular use case is that I would like
a way of discovering all repositories available for cloning. A
client that clones via
git clone user@example.com
can invoke a command by
ssh user@example.com $command
Signed-off-by: Greg Brockman <gdb@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The function rewrite_one is used to rewrite a single
parent of the current commit, and is used by rewrite_parents
to rewrite all the parents.
Decouple the dependence between them by making rewrite_one
a callback function that is passed to rewrite_parents. Then
export rewrite_parents for reuse by the line history browser.
We will use this function in line.c.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
To correctly track the line ranges over several branches,
we must make sure that we have processed all children before
reaching the commit itself.
Thus we introduce a first pass in cmd_line_log that runs
prepare_revision_walk to achieve the topological ordering.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
'struct line_chunk' is used to make sure each file is scanned
only once when printing the lines. We track the starting line
number and the offsets of all lines in the range in this struct.
We use two functions from diff.c to generate meta info and hunk
headers in the usual format.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When going from a commit to its parents, we map the "interesting"
range of lines according to the change made.
For non-merge commit, we just run map_range on the ranges, which
works as follows:
1. Run diffcore_std to find out the pre/postimage for each file.
2. Run xdi_diff_hunks on each interesting set of pre/postimages.
3. The map_range_cb callback is invoked for each hunk by the diff
engine, and we use it to calculate the pre-image range from the
post-image range in the function map_lines.
For merge commits, we run map_range once for every parent.
Simultaneously we use a take_range pass to eliminate all ranges
that are identical. If any ranges remain after that, then the
merge is considered non-trivial.
The algorithm that maps lines from post-image to pre-image is in
the function map_lines. Generally, we use simple line number
calculation method to do the map.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Since diff_line_range can form a single list through its
'next' pointer, we provide two kind of clone.
diff_line_range_clone:
used to clone only the element node and set the
element's 'next' pointer to NULL.
diff_line_range_clone_deeply:
used to clone the whole list of ranges.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Use fill_metainfo to fill the line level diff meta data,
emit_line to print out a line and quote_two to quote
paths.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
With the two new APIs of parse options added in the previous
commit, we parse the multiple '-L n,m <pathspec>' syntax.
Notice that users can give more than one '-L n,m' for each pathspec.
And a pathspec with all its '-L' options maps to a single
diff_line_range structure.
This has the exactly the same semantics as 'git blame -L n,m <pathspec>'
because we refactored and reused the blame code.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Both 'git blame -L' and 'git log -L' parse the same style
of line number arguments, so put the 'parse_loc' function
to line.c and export it.
The caller of parse_loc should provide a callback function
which is used to calculate the start position of the nth line.
Other parts such as regexp search, line number parsing are
abstracted and re-used.
Note that, we can use '$' to specify the last line of a file.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
'struct diff_line_range' is the main data structure to keep
track of the line ranges we are currently interested in. The
user starts digging from a line range, and after examining the
diff that affects that range by a commit, we can find a new
range that corresponds to this range. So, we will associate this
new range with the commit's parent commit.
There is one 'diff_line_range' for each file, and there are
multiple 'struct line_range' in each 'diff_line_range'. In this way,
we support multiple ranges.
Within 'struct line_range', there are multiple 'struct print_range'
which represent a diff hunk.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1. parse_options_current: get the current option/argument the API
is dealing with;
2. parse_options_next: skip the current argument, moving to the
next one. Unless 'keep' is set, discard the skipped argument
from the final argument list.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Make parse_options_step() report PARSE_OPT_NON_OPTION instead
of PARSE_OPT_DONE to the caller, when it sees a non-option argument.
This will help implementing a nonstandard option syntax that
takes more than one parameters to an option, e.g.
-L n1,m1 pathspec1 -L n2,m2 pathspec2
by directly calling parse_options_step(). The parse_options() API
only calls parse_options_step() once, and its callers are not affected
by this change.
Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Without this, attempting to index a pack containing objects that have been
replaced results in a fatal error that looks like:
fatal: SHA1 COLLISION FOUND WITH <replaced-object> !
Signed-off-by: Nelson Elhage <nelhage@ksplice.com>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* tr/rfc-reset-doc:
Documentation/reset: move "undo permanently" example behind "make topic"
Documentation/reset: reorder examples to match description
Documentation/reset: promote 'examples' one section up
Documentation/reset: separate options by mode
Documentation/git-reset: reorder modes for soft-mixed-hard progression