<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/diff-lib.c, branch v1.6.3.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v1.6.3.1</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v1.6.3.1'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2009-03-18T01:54:31Z</updated>
<entry>
<title>Merge branch 'kb/checkout-optim'</title>
<updated>2009-03-18T01:54:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2009-03-18T01:54:31Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=a9bfe813094cf2c8ea0e30c3196070c868fb294c'/>
<id>urn:sha1:a9bfe813094cf2c8ea0e30c3196070c868fb294c</id>
<content type='text'>
* kb/checkout-optim:
  Revert "lstat_cache(): print a warning if doing ping-pong between cache types"
  checkout bugfix: use stat.mtime instead of stat.ctime in two places
  Makefile: Set compiler switch for USE_NSEC
  Create USE_ST_TIMESPEC and turn it on for Darwin
  Not all systems use st_[cm]tim field for ns resolution file timestamp
  Record ns-timestamps if possible, but do not use it without USE_NSEC
  write_index(): update index_state-&gt;timestamp after flushing to disk
  verify_uptodate(): add ce_uptodate(ce) test
  make USE_NSEC work as expected
  fix compile error when USE_NSEC is defined
  check_updates(): effective removal of cache entries marked CE_REMOVE
  lstat_cache(): print a warning if doing ping-pong between cache types
  show_patch_diff(): remove a call to fstat()
  write_entry(): use fstat() instead of lstat() when file is open
  write_entry(): cleanup of some duplicated code
  create_directories(): remove some memcpy() and strchr() calls
  unlink_entry(): introduce schedule_dir_for_removal()
  lstat_cache(): swap func(length, string) into func(string, length)
  lstat_cache(): generalise longest_match_lstat_cache()
  lstat_cache(): small cleanup and optimisation
</content>
</entry>
<entry>
<title>Generalize and libify index_is_dirty() to index_differs_from(...)</title>
<updated>2009-02-11T06:25:39Z</updated>
<author>
<name>Stephan Beyer</name>
<email>s-beyer@gmx.net</email>
</author>
<published>2009-02-10T14:30:35Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=75f3ff2eeaba820b37016f464b6d1078cb6260e2'/>
<id>urn:sha1:75f3ff2eeaba820b37016f464b6d1078cb6260e2</id>
<content type='text'>
index_is_dirty() in builtin-revert.c checks if the index is dirty.
This patch generalizes this function to check if the index differs
from a revision, i.e. the former index_is_dirty() behavior can now be
achieved by index_differs_from("HEAD", 0).

The second argument "diff_flags" allows to set further diff option
flags like DIFF_OPT_IGNORE_SUBMODULES. See DIFF_OPT_* macros in diff.h
for a list.

index_differs_from() seems to be useful for more than builtin-revert.c,
so it is moved into diff-lib.c and also used in builtin-commit.c.

Yet to mention:

 - "rev.abbrev = 0;" can be safely removed.
   This has no impact on performance or functioning of neither
   setup_revisions() nor run_diff_index().

 - rev.pending.objects is free()d because this fixes a leak.
   (Also see 295dd2ad "Fix memory leak in traverse_commit_list")

Mentored-by: Daniel Barkalow &lt;barkalow@iabervon.org&gt;
Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Stephan Beyer &lt;s-beyer@gmx.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>lstat_cache(): swap func(length, string) into func(string, length)</title>
<updated>2009-02-10T04:59:26Z</updated>
<author>
<name>Kjetil Barvik</name>
<email>barvik@broadpark.no</email>
</author>
<published>2009-02-09T20:54:06Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=571998921d8fd4ee674545406aabb86987921252'/>
<id>urn:sha1:571998921d8fd4ee674545406aabb86987921252</id>
<content type='text'>
Swap function argument pair (length, string) into (string, length) to
conform with the commonly used order inside the GIT source code.

Also, add a note about this fact into the coding guidelines.

Signed-off-by: Kjetil Barvik &lt;barvik@broadpark.no&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Cleanup of unused symcache variable inside diff-lib.c</title>
<updated>2009-01-11T23:56:55Z</updated>
<author>
<name>Kjetil Barvik</name>
<email>barvik@broadpark.no</email>
</author>
<published>2009-01-11T18:36:42Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=ff7e6aad6d995a52e88cfeaae10cf8a768ff2358'/>
<id>urn:sha1:ff7e6aad6d995a52e88cfeaae10cf8a768ff2358</id>
<content type='text'>
Commit c40641b77b0274186fd1b327d5dc3246f814aaaf, 'Optimize
symlink/directory detection' by Linus Torvalds, removed the 'char
*symcache' parameter to the has_symlink_leading_path() function.  This
made all variables currently named 'symcache' inside diff-lib.c
unnecessary.

This also let us throw away the 'struct oneway_unpack_data', and
instead directly use the 'struct rev_info *revs' member, which
was the only member left after removal of the 'symcache[] array'
member.  The 'struct oneway_unpack_data' was introduced by the
following commit:

  948dd346  "diff-files: careful when inspecting work tree items"

Impact: cleanup
        PATH_MAX bytes less memory stack usage in some cases

Signed-off-by: Kjetil Barvik &lt;barvik@broadpark.no&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diff: vary default prefix depending on what are compared</title>
<updated>2008-08-31T03:53:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-08-19T03:08:09Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=a5a818ee4877e4458e8e6741a03ac3b19941d58a'/>
<id>urn:sha1:a5a818ee4877e4458e8e6741a03ac3b19941d58a</id>
<content type='text'>
With a new configuration "diff.mnemonicprefix", "git diff" shows the
differences between various combinations of preimage and postimage trees
with prefixes different from the standard "a/" and "b/".  Hopefully this
will make the distinction stand out for some people.

    "git diff" compares the (i)ndex and the (w)ork tree;
    "git diff HEAD" compares a (c)ommit and the (w)ork tree;
    "git diff --cached" compares a (c)ommit and the (i)ndex;
    "git-diff HEAD:file1 file2" compares an (o)bject and a (w)ork tree entity;
    "git diff --no-index a b" compares two non-git things (1) and (2).

Because these mnemonics now have meanings, they are swapped when reverse
diff is in effect and this feature is enabled.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Fix buffer overflow in git diff</title>
<updated>2008-07-16T21:03:24Z</updated>
<author>
<name>Dmitry Potapov</name>
<email>dpotapov@gmail.com</email>
</author>
<published>2008-07-16T14:54:02Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=fd55a19eb1d49ae54008d932a65f79cd6fda45c9'/>
<id>urn:sha1:fd55a19eb1d49ae54008d932a65f79cd6fda45c9</id>
<content type='text'>
If PATH_MAX on your system is smaller than a path stored, it may cause
buffer overflow and stack corruption in diff_addremove() and diff_change()
functions when running git-diff

Signed-off-by: Dmitry Potapov &lt;dpotapov@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>"git diff": do not ignore index without --no-index</title>
<updated>2008-05-24T07:16:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-05-24T05:28:56Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=0569e9b8cea20d5eedfec66730a9711a0907ab0d'/>
<id>urn:sha1:0569e9b8cea20d5eedfec66730a9711a0907ab0d</id>
<content type='text'>
Even if "foo" and/or "bar" does not exist in index, "git diff foo bar"
should not change behaviour drastically from "git diff foo bar baz" or
"git diff foo".  A feature that "sometimes works and is handy" is an
unreliable cute hack.

"git diff foo bar" outside a git repository continues to work as a more
colourful alternative to "diff -u" as before.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Optimize symlink/directory detection</title>
<updated>2008-05-11T01:16:31Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2008-05-09T16:21:07Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=c40641b77b0274186fd1b327d5dc3246f814aaaf'/>
<id>urn:sha1:c40641b77b0274186fd1b327d5dc3246f814aaaf</id>
<content type='text'>
This is the base for making symlink detection in the middle fo a pathname
saner and (much) more efficient.

Under various loads, we want to verify that the full path leading up to a
filename is a real directory tree, and that when we successfully do an
'lstat()' on a filename, we don't get a false positive due to a symlink in
the middle of the path that git should have seen as a symlink, not as a
normal path component.

The 'has_symlink_leading_path()' function already did this, and cached
a single level of symlink information, but didn't cache the _lack_ of a
symlink, so the normal behaviour was actually the wrong way around, and we
ended up doing an 'lstat()' on each path component to check that it was a
real directory.

This caches the last detected full directory and symlink entries, and
speeds up especially deep directory structures a lot by avoiding to
lstat() all the directories leading up to each entry in the index.

[ This can - and should - probably be extended upon so that we eventually
  never do a bare 'lstat()' on any path entries at *all* when checking the
  index, but always check the full path carefully. Right now we do not
  generally check the whole path for all our normal quick index
  revalidation.

  We should also make sure that we're careful about all the invalidation,
  ie when we remove a link and replace it by a directory we should
  invalidate the symlink cache if it matches (and vice versa for the
  directory cache).

  But regardless, the basic function needs to be sane to do that. The old
  'has_symlink_leading_path()' was not capable enough - or indeed the code
  readable enough - to really do that sanely. So I'm pushing this as not
  just an optimization, but as a base for further work. ]

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'py/diff-submodule'</title>
<updated>2008-05-11T01:16:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-05-11T01:16:25Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=2855e70ad11abf7e7f30f975b063bd60d5abdf4f'/>
<id>urn:sha1:2855e70ad11abf7e7f30f975b063bd60d5abdf4f</id>
<content type='text'>
* py/diff-submodule:
  is_racy_timestamp(): do not check timestamp for gitlinks
  diff-lib.c: rename check_work_tree_entity()
  diff: a submodule not checked out is not modified
  Add t7506 to test submodule related functions for git-status
  t4027: test diff for submodule with empty directory
</content>
</entry>
<entry>
<title>Merge branch 'jc/lstat'</title>
<updated>2008-05-06T02:16:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2008-05-06T02:16:26Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=867fa20fe929942fba2345adc591e6f5c74f8c11'/>
<id>urn:sha1:867fa20fe929942fba2345adc591e6f5c74f8c11</id>
<content type='text'>
* jc/lstat:
  diff-files: mark an index entry we know is up-to-date as such
  write_index(): optimize ce_smudge_racily_clean_entry() calls with CE_UPTODATE
</content>
</entry>
</feed>
