Skip to content

When doing operations on hunks, vim needs to recalculate hunk headers #2

Open
@mcepl

Description

@mcepl

If I have these hunks:

index: python-2.6.7/makefile.pre.in
===================================================================
--- python-2.6.7.orig/makefile.pre.in	2012-02-08 18:42:19.000000000 +0100
+++ python-2.6.7/makefile.pre.in	2012-02-08 18:42:58.000000000 +0100
@@ -75,6 +75,8 @@
 
 # machine-dependent subdirectories
 machdep=	@machdep@
+lib=		@lib@
+arch=		@arch@
 
 # install prefix for architecture-independent files
 prefix=		@prefix@
@@ -509,6 +511,7 @@
 		-dexec_prefix='"$(exec_prefix)"' \
 		-dversion='"$(version)"' \
 		-dvpath='"$(vpath)"' \
+		-darch='"$(arch)"' -dlib='"$(lib)"' \
 		-o $@ $(srcdir)/modules/getpath.c
 
 modules/python.o: $(srcdir)/modules/python.c
@@ -540,7 +543,7 @@
 Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
 
 Python/getplatform.o: $(srcdir)/Python/getplatform.c
-		$(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
+		$(CC) -c $(PY_CFLAGS) -DPLATFORM='"linux2"' -DARCH='"$(ARCH)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
 
 Python/importdl.o: $(srcdir)/Python/importdl.c
 		$(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c

Then the first one actually adds two lines, so I would expect that header of the second hunk after deleting the first one (didh) would change to @@ -509,6 +509,7 @@. It doesn't, it still stays the same. See https://gitlab.com/mcepl/vim-diff_navigator for the illustration, how it could be done. Not sure how to do it with vim text objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions