]> git.neil.brown.name Git - wiggle.git/log
wiggle.git
7 months agoDisable *all* backups when --no-backups used master
NeilBrown [Wed, 13 Sep 2023 07:08:30 +0000 (17:08 +1000)]
Disable *all* backups when --no-backups used

The patch that introduced --no-backups only disabled backups in "-B"
mode, not with normal usage.

This patch extended that to all backups to "*.porig".

Fixes-github-issue: #25
Signed-off-by: NeilBrown <neil@brown.name>
9 months agoMakefile: ensure "make lib" sees changes to wiggle.h
NeilBrown [Fri, 21 Jul 2023 06:19:02 +0000 (16:19 +1000)]
Makefile: ensure "make lib" sees changes to wiggle.h

I don't know why the "::" are here, but they don't seem to be needed.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoNew release: v1.3 v1.3
NeilBrown [Sat, 3 Oct 2020 10:49:53 +0000 (20:49 +1000)]
New release: v1.3

- performance improvements when comparing large files
- libwiggle.a can be built for other tools to use
- Makefile is quieter and can put binaries elsewhere
- fix a bug that corrupted the format of output in some cases.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAdd copyright claims through to 2020
NeilBrown [Sat, 3 Oct 2020 10:45:48 +0000 (20:45 +1000)]
Add copyright claims through to 2020

Update copyright claims.
also update email address (though old one is still good too)

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoRe-indent code messed up by name-change.
NeilBrown [Sat, 3 Oct 2020 10:34:54 +0000 (20:34 +1000)]
Re-indent code messed up by name-change.

Previous patch made some names longer which messed up some
indenting alignment.  So re-indent things to look better.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAdd "wiggle_" prefix to all exported names.
NeilBrown [Sat, 3 Oct 2020 10:29:36 +0000 (20:29 +1000)]
Add "wiggle_" prefix to all exported names.

All global names visible in libwiggle now start 'wiggle_'.
This makes conflicts less likely.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoMove save functions to vpatch.c
NeilBrown [Sat, 3 Oct 2020 10:21:13 +0000 (20:21 +1000)]
Move save functions to vpatch.c

save_merge and save_tmp_merge are only used in vpatch.c and don't
depend on anything from merge2.c that isn't exported, so move
them to vpatch.c

Signed-off-by: NeilBrown <neil@brown.name>
3 years agovpatch: make things static that are not shared.
NeilBrown [Sat, 3 Oct 2020 10:09:57 +0000 (20:09 +1000)]
vpatch: make things static that are not shared.

The only symbol from vpatch.c that needs to be exported is "vpatch", so
make the rest "static"

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoSplit non-static code out of wiggle.c
NeilBrown [Sat, 3 Oct 2020 10:05:57 +0000 (20:05 +1000)]
Split non-static code out of wiggle.c

wiggle.c container some code that other files reference.
Now that this other file can live in a library (libwiggle),
move that code into a new file - util.c - so it is
available in the library.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agomerge: fix a problem with unmatchable hunks.
NeilBrown [Sat, 3 Oct 2020 09:30:34 +0000 (19:30 +1000)]
merge: fix a problem with unmatchable hunks.

If the patch contains hunks that cannot be matched, wiggle cannot to
anything really useful, but sometimes it does something bad and produces
a badly formatted result.

In these cases, the hunk must get placed somewhere, and it is possible
that two hunks could line up with different places in the same line of
the original.

As wiggle normally expands conflicts to cover whole lines, to display
this coherently, you would need something like

<<<
chosen line
||||
hunk1- before
hunk2- before
===
hunk1- after
hunk2- after
>>>

But wiggle assumes that a hunk header marks the end of a conflict, so
bad things happen here.
I don't want to display the hunk header, so I think the best option is

<<<
chosen line
|||
hunk1- before
===
hunk1- after
>>>
<<<
|||
hunk2- before
===
hunk2- after
>>>

To achieve this, we don't stop collecting a conflict when we hit a
hunk-header moving forward, but when we print the conflict out, we
detect those hunk headers, and do the above.
If the final hunk doesn't actually contain any differences, don't
bother printing it.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoTest must not expose non-determinism.
NeilBrown [Mon, 7 Sep 2020 09:40:52 +0000 (19:40 +1000)]
Test must not expose non-determinism.

The recent heuristic to make 'diff' faster introduce non-determinism
which is bad for testing.

So add option to set the loop count rather than having a maximum running
time.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAdd heuristic to take shortcut when too slow.
NeilBrown [Mon, 7 Sep 2020 07:34:05 +0000 (17:34 +1000)]
Add heuristic to take shortcut when too slow.

If find_common takes more than 20msec to find the minimum edit distance,
take the next snake and assume it is good enough - and find sub-paths
before and after it.  This gets a result quickly, but maybe not the
best result.

Add option --shortest to get the best result.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoFix exit status from 'diff'.
NeilBrown [Mon, 7 Sep 2020 06:34:10 +0000 (16:34 +1000)]
Fix exit status from 'diff'.

Exit status of 'diff' count the number of differences, then take low
bits.
This is nonsense.  Make it 1 if there are differences.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agodiff: trim endpoints of search more agressively.
NeilBrown [Sun, 6 Sep 2020 22:22:57 +0000 (08:22 +1000)]
diff: trim endpoints of search more agressively.

When we find a long snake, we significantly reduce the worst-case
result (which is "no more snakes ever").  This allows us to trim the
end-points of the search-font.  If the endpoints have a best-case that
is worst than the worst-case when using the new snake, there is no point
pursuing them.
Previously we only trimmed the ends one step for each step forward.
This is unnecessarily cautious.  It is better to keep trimming until
the best-case at the end reaches the worst-case.

This improves one test case about 20%.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agodiff: allocate csl buf incrementally.
NeilBrown [Sun, 6 Sep 2020 23:49:40 +0000 (09:49 +1000)]
diff: allocate csl buf incrementally.

The csl buff is currently allocated after the first pass, and filled in
during the second recursively-subdivided pass.
This means the two passes need to produce exactly the same result,
which makes it hard to introduce heuristics to cut corners on
big searches.

So change to allocating incrementally (in powers of 2) as needed.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoAutomatically enable --non-space on large files.
NeilBrown [Sat, 29 Aug 2020 08:29:38 +0000 (18:29 +1000)]
Automatically enable --non-space on large files.

If a file has more than 50,000 words, switch on --non-space to hopefully
reduce the number of words, and hence the running time.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoIntroduce --non-space option
NeilBrown [Sat, 29 Aug 2020 08:15:52 +0000 (18:15 +1000)]
Introduce --non-space option

This can significantly reduce the number of words by treating
punctuation as part of the surrounding word, rather than as single-char
words.
Fewer words can mean much faster comparisons.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agodiff: filter out unmatchable lines before comparing.
NeilBrown [Sat, 29 Aug 2020 07:06:27 +0000 (17:06 +1000)]
diff: filter out unmatchable lines before comparing.

If either file has a run of 2 or more consecutive lines, none of which
appear in the other file, then reduce the run down to a single line.
This does not materially change the set of common-sub-lists that are
calculated, but it can make the calculate much faster when there is a
lot of unmatchable lines.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agovpatch: fix problems reported by valgrind.
NeilBrown [Sat, 29 Aug 2020 04:17:02 +0000 (14:17 +1000)]
vpatch: fix problems reported by valgrind.

test code isn't much good if you don't run it...

I ran 'make vtest' and fixed the problems reported.

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoFix handling of -R with --diff
NeilBrown [Fri, 28 Aug 2020 23:18:36 +0000 (09:18 +1000)]
Fix handling of -R with --diff

I was swapping the wrong to files with -Rd

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoMakefile: add support for quite build.
NeilBrown [Fri, 28 Aug 2020 23:04:33 +0000 (09:04 +1000)]
Makefile: add support for quite build.

"make" is now less noisy, unless you pass 'V=1'

Signed-off-by: NeilBrown <neil@brown.name>
3 years agoMakefile: make it easy to place objects in different dir
NeilBrown [Wed, 26 Aug 2020 22:18:57 +0000 (08:18 +1000)]
Makefile: make it easy to place objects in different dir

Objects can easily be placed elsewhere, and go in 'O/' by default.

Code that might be useful to other tools is now collected into
a library for easy access.

Signed-off-by: NeilBrown <neil@brown.name>
4 years agoNew release - v1.2 v1.2
NeilBrown [Fri, 27 Dec 2019 05:03:32 +0000 (16:03 +1100)]
New release - v1.2

Release v1.2
Also remove "ChangeLog" which didn't add any value.

Signed-off-by: NeilBrown <neil@brown.name>
4 years agoMerge github.com:neilbrown/wiggle
NeilBrown [Fri, 27 Dec 2019 05:11:58 +0000 (16:11 +1100)]
Merge github.com:neilbrown/wiggle

4 years agomerge2: guard against over-flowing elcnt
NeilBrown [Fri, 27 Dec 2019 04:58:27 +0000 (15:58 +1100)]
merge2: guard against over-flowing elcnt

It should be impossible to overflow elcnt in these
cases, but I have seen it happen.
There must be bug somewhere else, but for now, just prevent the
crash.

Signed-off-by: NeilBrown <neil@brown.name>
4 years agosplit_stream: guard against body being NULL.
NeilBrown [Fri, 27 Dec 2019 04:54:46 +0000 (15:54 +1100)]
split_stream: guard against body being NULL.

If body is NULL, adding 'len' to it makes no sense.
Just abort early in that case.

Signed-off-by: NeilBrown <neil@brown.name>
4 years agovpatch: if backups are disabled, don't try to restore.
NeilBrown [Fri, 27 Dec 2019 04:52:05 +0000 (15:52 +1100)]
vpatch: if backups are disabled, don't try to restore.

vpatch (--browse) has a 'R' restore command.  If
backups are disabled it cannot work, so don't try.

Signed-off-by: NeilBrown <neil@brown.name>
4 years agovpatch: don't call fileno() on NULL
NeilBrown [Fri, 27 Dec 2019 04:48:24 +0000 (15:48 +1100)]
vpatch: don't call fileno() on NULL

Move the check_dir() call to *after* we check if
fopen failed.

Signed-off-by: NeilBrown <neil@brown.name>
4 years agovpatch: guard against patch list being empty.
NeilBrown [Fri, 27 Dec 2019 04:45:53 +0000 (15:45 +1100)]
vpatch: guard against patch list being empty.

Mostly and empty list works, but get_prev() can
mess up - so fix it.

Signed-off-by: NeilBrown <neil@brown.name>
4 years agovpatch: call sort_patches() before main_window().
NeilBrown [Fri, 27 Dec 2019 04:31:48 +0000 (15:31 +1100)]
vpatch: call sort_patches() before main_window().

sort_patches() can reallocate the patch list array.
So after main_window is called (which calls sort_patches())
the patchs array might have changed.  We current call
plist_free() on the old patch list, which can crash.

So instead, call sort_patches() before calling main_window(),
then call plist_free() afterwards, on the patch list
that sort_patches() returned.
This avoids the crash.

Signed-off-by: NeilBrown <neil@brown.name>
4 years agoMerge pull request #16 from smcameron/master
NeilBrown [Thu, 3 Oct 2019 00:00:11 +0000 (10:00 +1000)]
Merge pull request #16 from smcameron/master

Fix very minor memory leaks in do_merge()

4 years agoDo not test for NULL before free()
Stephen M. Cameron [Wed, 2 Oct 2019 23:40:54 +0000 (19:40 -0400)]
Do not test for NULL before free()

Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
4 years agoFix very minor memory leaks in do_merge()
Stephen M. Cameron [Tue, 1 Oct 2019 11:17:40 +0000 (07:17 -0400)]
Fix very minor memory leaks in do_merge()

Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
4 years agoMerge pull request #15 from gobenji/master
NeilBrown [Tue, 10 Sep 2019 00:45:15 +0000 (10:45 +1000)]
Merge pull request #15 from gobenji/master

Preserve file mode when using doing --merge --replace

4 years agoPreserve file mode when using doing --merge --replace
Benjamin Poirier [Tue, 27 Aug 2019 05:28:43 +0000 (14:28 +0900)]
Preserve file mode when using doing --merge --replace

4 years agoAdd --no-backup option
NeilBrown [Sat, 3 Aug 2019 02:34:37 +0000 (12:34 +1000)]
Add --no-backup option

If --no-backup is given, the files are never renamed to "foo.porig",
They are simply replaced.

Requested-by: youssefsharief @ github.com
Resolves-github-issue: #14
Signed-off-by: NeilBrown <neilb@suse.de>
4 years agoextract: allow blank lines in unified diffs.
NeilBrown [Sat, 3 Aug 2019 02:11:56 +0000 (12:11 +1000)]
extract: allow blank lines in unified diffs.

When a unified diff report that both files have a blank line,
it shows this as a line containing just a space.
Sometimes that space can go missing (spaces at the end of a line
are like that).
So if we find a completely empty line, treat it like a line
containing just a space.

Resolves-github-issue: #12
Reported-by: luckydonald @ github.com
Signed-off-by: NeilBrown <neilb@suse.de>
4 years agoAvoid use of "?:"
NeilBrown [Sat, 3 Aug 2019 01:47:43 +0000 (11:47 +1000)]
Avoid use of "?:"

Some compilers (gcc with -pedantic) don't like the ?:
construct.  So give an explicit middle term.

Reported-by: Jari Aalto <jari.aalto@cante.net
Signed-off-by: NeilBrown <neilb@suse.de>
4 years agoFix array bounds error in diff_path
NeilBrown [Sat, 3 Aug 2019 01:45:29 +0000 (11:45 +1000)]
Fix array bounds error in diff_path

If elcnt is zero, we shouldn't even look at list[0].

Signed-off-by: NeilBrown <neilb@suse.de>
5 years agoMerge pull request #11 from e7appew/gcc8-format-security
NeilBrown [Fri, 25 Jan 2019 06:22:44 +0000 (17:22 +1100)]
Merge pull request #11 from e7appew/gcc8-format-security

Fix format overflow and truncation warnings with GCC-8.

5 years agoMerge pull request #10 from e7appew/fix-typos
NeilBrown [Fri, 25 Jan 2019 06:21:22 +0000 (17:21 +1100)]
Merge pull request #10 from e7appew/fix-typos

Fix some typos.

5 years agoFix format overflow and truncation warnings with GCC-8.
Carlos Maddela [Thu, 24 Jan 2019 18:04:46 +0000 (05:04 +1100)]
Fix format overflow and truncation warnings with GCC-8.

5 years agoFix some typos.
Carlos Maddela [Thu, 24 Jan 2019 10:04:57 +0000 (21:04 +1100)]
Fix some typos.

6 years agoInitialize 'o' just in case.
NeilBrown [Fri, 29 Sep 2017 02:43:55 +0000 (12:43 +1000)]
Initialize 'o' just in case.

Some compilers complain that this might be used
uninitialised.  They are wrong as it is only used when 'found' is
non-zero, and it is always set before found is set, but
as I like -Werror, I need to handle bad warnings too.

Fixes #6

Signed-off-by: NeilBrown <neilb@suse.de>
6 years agoRelease v1.1 v1.1
NeilBrown [Thu, 28 Sep 2017 12:37:04 +0000 (22:37 +1000)]
Release v1.1

No substantial changes, just 4 years of tiny bits and pieces.

Fixed #9

Signed-off-by: NeilBrown <neil@brown.name>
6 years agohash.c: add /* fallthrough markers */
NeilBrown [Thu, 28 Sep 2017 12:29:12 +0000 (22:29 +1000)]
hash.c: add /* fallthrough markers */

Recent gcc warns about case fall-through, so tell it not to.

Signed-off-by: NeilBrown <neil@brown.name>
6 years agovpatch: fix build warning
NeilBrown [Thu, 28 Sep 2017 12:25:15 +0000 (22:25 +1000)]
vpatch: fix build warning

This condition was a bit convoluted and while it was correct,
it doesn't look it.

Move the '!' into the '==' so the intention is a bit clearer
and compiler doesn't complain.

Fixes #7

Signed-off-by: NeilBrown <neil@brown.name>
9 years agoMerge branch 'allow-prefix-on-make' of https://github.com/ankon/wiggle
NeilBrown [Tue, 13 May 2014 23:32:08 +0000 (09:32 +1000)]
Merge branch 'allow-prefix-on-make' of https://github.com/ankon/wiggle

9 years agoUse install(1) -d explicitly, avoiding the need for -D
Andreas Kohn [Tue, 13 May 2014 23:06:36 +0000 (01:06 +0200)]
Use install(1) -d explicitly, avoiding the need for -D

-D isn't available on MacOS X by default, but there is not much point
here in using it: we can just create the directories first.

9 years agoAdd a PREFIX variable so one can easily install wiggle into a different tree
Andreas Kohn [Tue, 13 May 2014 23:08:55 +0000 (01:08 +0200)]
Add a PREFIX variable so one can easily install wiggle into a different tree

Main use-case here: make install PREFIX=$HOME, to have it install into the user's
$HOME directory.

10 years agoman: Correct preceeding to preceding
Jari Aalto [Tue, 8 Apr 2014 06:23:56 +0000 (09:23 +0300)]
man: Correct preceeding to preceding

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoFix endian checks as per austin group definitions of endian.h
Dimitri John Ledkov [Mon, 6 Jan 2014 03:57:03 +0000 (03:57 +0000)]
Fix endian checks as per austin group definitions of endian.h

Debian-Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733831
Reference: http://www.opengroup.org/austin/docs/austin_514.txt

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMakefile: make it easy to suppress the "-D" flag to "install".
NeilBrown [Wed, 16 Oct 2013 01:58:51 +0000 (12:58 +1100)]
Makefile: make it easy to suppress the "-D" flag to "install".

Some versions of "install" do not support '-D', and it isn't needed
when installing to default location.
So all
  make INSTALL=install
to suppress the -D

Reported-by: Christian Sonne
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMakefile: make it easy to change warning flags.
NeilBrown [Wed, 16 Oct 2013 01:54:26 +0000 (12:54 +1100)]
Makefile: make it easy to change warning flags.

Some people need to get rid of "-Werror".
Make that easier wit
  make CWFLAGS=

Reported-by: Christian Sonne
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMerge branch 'master' of https://github.com/seanfarley/wiggle
NeilBrown [Wed, 9 Oct 2013 00:19:01 +0000 (11:19 +1100)]
Merge branch 'master' of https://github.com/seanfarley/wiggle

10 years agomakefile: add -Wno-missing-field-initializers since {0} is valid C99
Sean Farley [Sun, 6 Oct 2013 00:46:33 +0000 (08:46 +0800)]
makefile: add -Wno-missing-field-initializers since {0} is valid C99

10 years agovpatch: change prepare_merge to a macro for proper c
Sean Farley [Tue, 8 Oct 2013 23:23:45 +0000 (07:23 +0800)]
vpatch: change prepare_merge to a macro for proper c

10 years agovpatch: change find_line to a macro for proper c
Sean Farley [Tue, 8 Oct 2013 23:23:11 +0000 (07:23 +0800)]
vpatch: change find_line to a macro for proper c

10 years agovpatch: change free_stuff to a macro for proper c
Sean Farley [Tue, 8 Oct 2013 14:36:35 +0000 (22:36 +0800)]
vpatch: change free_stuff to a macro for proper c

10 years agovpatch: avoid warning from gcc-4.4.6
NeilBrown [Tue, 27 Aug 2013 23:38:33 +0000 (09:38 +1000)]
vpatch: avoid warning from gcc-4.4.6

It seems that gcc-4.4.6 doesn't like

   struct plist p = {0};

as it don't initialise all fields.
I only added that to make sure 'outfile' was initialised, so
just do that explicitly.

Reported-by: Stephen Cameron @ G+
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMakefile: suppress error messages from 'git'.
NeilBrown [Tue, 27 Aug 2013 23:35:14 +0000 (09:35 +1000)]
Makefile: suppress error messages from 'git'.

If you have a clone of the 'wiggle' git tree but with no
tags, then "git describe HEAD" will complain
   fatal: No names found, cannot describe anything.
As it produces no output, the compiled in default will be used
so this is just an unnecessary message.  So send it to /dev/null.

Reported-by: Stephen Cameron @ G+
Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoRelease wiggle v1.0 v1.0
NeilBrown [Fri, 23 Aug 2013 06:02:27 +0000 (16:02 +1000)]
Release wiggle v1.0

Hurray!

10 years agoAdd 'dovtest'.
NeilBrown [Fri, 23 Aug 2013 06:01:27 +0000 (16:01 +1000)]
Add 'dovtest'.

This runs 'browser' mode under valgrind to look for errors.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: avoid unused-variable error from valgrind.
NeilBrown [Fri, 23 Aug 2013 05:59:37 +0000 (15:59 +1000)]
Browser: avoid unused-variable error from valgrind.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: refine 'c' and 'x' commands.
NeilBrown [Fri, 23 Aug 2013 05:32:19 +0000 (15:32 +1000)]
Browser: refine 'c' and 'x' commands.

'x' will try to make text go away.
'c' will try to make text stay.
'X' will undo all such changes on the current line.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: remove some more infinite loops.
NeilBrown [Fri, 23 Aug 2013 05:29:55 +0000 (15:29 +1000)]
Browser: remove some more infinite loops.

More places where we can get confused and then spin forever.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMan page updates.
NeilBrown [Fri, 23 Aug 2013 04:59:34 +0000 (14:59 +1000)]
Man page updates.

Lots of clean ups, fixes, additions etc

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoHack to improve view of ignore-blank conflicts.
NeilBrown [Fri, 23 Aug 2013 04:24:14 +0000 (14:24 +1000)]
Hack to improve view of ignore-blank conflicts.

  cd tests/contrib/abstract
  ../../../wiggle -Bb orig new new2
select the "central" and type 'x' so it disappears and note
that the only remaining difference is that "computational"
has been deleted.
Without this patch you only see one '-' line and no '+' line.

However the result isn't perfect as
   ./wiggle -Bp demo.patch
 visit the README file
 page down to waht "You can use 'o'  ..." as added.
And note that there is a '-' blank line and a '+' blank line.
These are unwanted and added by this patch.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: avoid possible infinite loop.
NeilBrown [Fri, 23 Aug 2013 03:10:12 +0000 (13:10 +1000)]
Browser: avoid possible infinite loop.

This can sometimes loop indefintely, so check for 'End' and
drop out.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: discard VTRACE code.
NeilBrown [Fri, 23 Aug 2013 01:35:15 +0000 (11:35 +1000)]
Browser: discard VTRACE code.

It doesn't really work any more and isn't really needed.
The status line at the top provides enough info.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: disable ignore-blanks after editing.
NeilBrown [Fri, 23 Aug 2013 01:20:54 +0000 (11:20 +1000)]
Browser: disable ignore-blanks after editing.

If we leave it enabled, then the result written out can
be different to the final edit and print_merge prefers the
A stream to the C stream.

Disabling it shouldn't hurt as now more cleverness is expected,
just viewing of the result.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: base tempfile name on that of original file.
NeilBrown [Fri, 23 Aug 2013 00:37:05 +0000 (10:37 +1000)]
Browser: base tempfile name on that of original file.

This way editor file-type detection (e.g. *.c means C file) works,
and as it is in the same directory, other related files are
easily found.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: delete temporary file after reading it back in.
NeilBrown [Fri, 23 Aug 2013 00:28:15 +0000 (10:28 +1000)]
Browser: delete temporary file after reading it back in.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoUpdate copyright claims.
NeilBrown [Thu, 22 Aug 2013 08:30:33 +0000 (18:30 +1000)]
Update copyright claims.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoman page: mention lack of Unicode support
NeilBrown [Thu, 22 Aug 2013 08:24:14 +0000 (18:24 +1000)]
man page: mention lack of Unicode support

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoman page: update instructions for git usage.
NeilBrown [Thu, 22 Aug 2013 08:21:43 +0000 (18:21 +1000)]
man page: update instructions for git usage.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoman page: Quote some more hyphen.
NeilBrown [Thu, 22 Aug 2013 08:05:29 +0000 (18:05 +1000)]
man page: Quote some more hyphen.

When we have a literal hyphen, we need to quote it.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAdd --output option to redirect output.
NeilBrown [Thu, 22 Aug 2013 07:54:42 +0000 (17:54 +1000)]
Add --output option to redirect output.

This is particularly useful for "git mergetool"

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: if editing leaves no conflicts, display diff.
NeilBrown [Thu, 22 Aug 2013 03:44:47 +0000 (13:44 +1000)]
Browser: if editing leaves no conflicts, display diff.

This isn't completely consistent behaviour, but it seems useful
for now.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: pass line number to editor when editting the merge.
NeilBrown [Thu, 22 Aug 2013 03:00:58 +0000 (13:00 +1000)]
Browser: pass line number to editor when editting the merge.

We calculate which line in the file the cursor is on and
pass that to the editor with "+N".

The calculation doesn't seem quite right sometimes, but
it is close.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: edit merge in a temporary file.
NeilBrown [Thu, 22 Aug 2013 03:24:40 +0000 (13:24 +1000)]
Browser: edit merge in a temporary file.

When editing a merge, do so in a temp file so it is still
easy to revert to the original.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser -- support page-up and page-down
NeilBrown [Wed, 21 Aug 2013 07:26:10 +0000 (17:26 +1000)]
Browser -- support page-up and page-down

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAllow diffs to be browsed.
NeilBrown [Wed, 21 Aug 2013 07:20:51 +0000 (17:20 +1000)]
Allow diffs to be browsed.

If --diff is given with --browse, then the diff can
be explored with colourful highlighting.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: add 'v' to open file in an editor.
NeilBrown [Wed, 21 Aug 2013 05:24:41 +0000 (15:24 +1000)]
Browser: add 'v' to open file in an editor.

'v' as in 'visual', just like 'less'.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoRemove stray file.
NeilBrown [Wed, 21 Aug 2013 02:38:40 +0000 (12:38 +1000)]
Remove stray file.

Don't know where this came from...

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agomanpage: add notes about how to integrate with git.
NeilBrown [Wed, 21 Aug 2013 02:34:33 +0000 (12:34 +1000)]
manpage: add notes about how to integrate with git.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAdd --report-wiggles option
NeilBrown [Wed, 21 Aug 2013 02:17:34 +0000 (12:17 +1000)]
Add --report-wiggles option

This results in 'failure' status if any wiggles were required.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: update all of status line in one place.
NeilBrown [Wed, 21 Aug 2013 01:46:48 +0000 (11:46 +1000)]
Browser: update all of status line in one place.

This removes the need to erase some number of spaces before
the right-justified bit, which was sometimes erasing too much.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoPreserve per-hunk "comment" field.
NeilBrown [Wed, 21 Aug 2013 01:40:59 +0000 (11:40 +1000)]
Preserve per-hunk "comment" field.

Each diff/patch hunk can have a comment, often a function
name extract with "diff -p".
Preserver that comment and display it when we print hunk headers,
particularly in the browser.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agovpatch: simplify display of editted mergers.
NeilBrown [Wed, 21 Aug 2013 00:19:30 +0000 (10:19 +1000)]
vpatch: simplify display of editted mergers.

Rather than having some special cases, simply use the original 'type'
unless RESULT is requested.  In that case use the new 'type'.

This is much more general and seems to work OK.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: add 'c' command to accept a conflict.
NeilBrown [Tue, 20 Aug 2013 23:35:01 +0000 (09:35 +1000)]
Browser: add 'c' command to accept a conflict.

'c' will change a 'Conflict' to 'Changed' so we keep the result
even though the 'before' part doesn't match.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoMake some fatal errors more helpful.
NeilBrown [Tue, 20 Aug 2013 05:29:53 +0000 (15:29 +1000)]
Make some fatal errors more helpful.

Complain sensibly if something is a directory, and
mention that read or malloc failed if it did.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowse: make sure 'X' doesn't loop forever searching backwards.
NeilBrown [Tue, 20 Aug 2013 05:12:42 +0000 (15:12 +1000)]
Browse: make sure 'X' doesn't loop forever searching backwards.

it did once..

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAllow interactive setting of "--ignore-blanks" flag.
NeilBrown [Tue, 20 Aug 2013 05:04:56 +0000 (15:04 +1000)]
Allow interactive setting of "--ignore-blanks" flag.

"I" will toggle whether blanks are significant or not
in matching text.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowse: suppress "last-key" debugging.
NeilBrown [Tue, 20 Aug 2013 01:19:42 +0000 (11:19 +1000)]
Browse: suppress "last-key" debugging.

Only display this if a suitable DEBUG envionment variable is set.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowse: allow "--replace" to be requested while viewing.
NeilBrown [Tue, 20 Aug 2013 01:10:54 +0000 (11:10 +1000)]
Browse: allow "--replace" to be requested while viewing.

If you type 'S' then on exit the file you are looking at
will be saved.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoBrowser: highlight spaces at the end of a line.
NeilBrown [Tue, 20 Aug 2013 00:42:23 +0000 (10:42 +1000)]
Browser: highlight spaces at the end of a line.

Otherwise they are invisible.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agoAdd some test after the markers in a merge.
NeilBrown [Mon, 19 Aug 2013 23:55:23 +0000 (09:55 +1000)]
Add some test after the markers in a merge.

"git rerere" likes to see a space after the "<<<<<<<" and
">>>>>>>".  So put it there and add a vaguely relevant word too.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agomerge: fix another bug in isolate_conflicts.
NeilBrown [Mon, 19 Aug 2013 07:44:16 +0000 (17:44 +1000)]
merge: fix another bug in isolate_conflicts.

In unusual cases we can fall off the end - better check.

Signed-off-by: NeilBrown <neilb@suse.de>
10 years agovpatch: discard 'ignored' for 'oldtype'.
NeilBrown [Mon, 19 Aug 2013 06:24:18 +0000 (16:24 +1000)]
vpatch: discard 'ignored' for 'oldtype'.

Rather than 'ignore'ing certain merges, we allow the type
of each merger to be modified.  This feels more flexible and
should be easier to understand.

Signed-off-by: NeilBrown <neilb@suse.de>