Age | Commit message (Collapse) | Author |
|
Remove old process code and comments.
|
|
I thought I'd resolved this problem by adding the `--no-pager` flag in
76079daf1e2175d02c9c584e47a21650fce30bb6, but it turns out that didn't
fix it.
When running the command, I'd get the following output, with the shell
prompt preceding the start of the diff, and the command hanging without
exiting to a new prompt line until a new interaction:
$ ./target/debug/git-sugdiff 459692838
$ diff --git a/src/server.rs b/44ff3b520321467a9220965d13f997690ff3fda7
index d9eee95..44ff3b5 100644
--- a/src/server.rs
+++ b/44ff3b520321467a9220965d13f997690ff3fda7
@@ -73,7 +73,7 @@ impl Server {
internal_server_error(&mut raw_request.stdout())
},
Error::ConduitResponse { .. } => {
error!("Error [-getting-]{+from+} response: {}", e);
internal_server_error(&mut raw_request.stdout())
},
Turns out I need to wait for the command to exit in order to properly
execute the external command.
|
|
Config::get():
Change `args` type so we can pass both a `Vec<String>` and
`Vec<&String>`.
diff_options.parse():
* Split diff arguments and program arguments by returning a tuple.
* Exit the args loop once we've parsed an argument.
* Update test
* Add a non-working test for suggestion arguments. An `OPT_OPTIONS`
argument could be followed by an argument that's not the value of the
`OPT_OPTIONS` option. Currently, that arg will always be parsed as the
value. We need to handle this case.
|
|
In order to accept Git diff options on the command line, we need a way
to extract these from args.
Add a function to parse diff options. These were sourced from:
https://github.com/git/git/blob/675a4aaf3b226c0089108221b96559e0baae5de9/Documentation/diff-options.txt
The function loops through the input arguments and extracts all diff
options and their values.
Still needs some work to integrate it into `git-sugdiff`, but it
currently works as advertised.
|
|
|
|
The word "patch" reminds me more of the `patch` Unix command, which is
what `git-sugapply` does.
Since this command outputs diffs, it makes more sense to call it
`sugdiff`. That also brings these closer to the native Git commands,
`git-diff` and `git-apply`.
I had chosen "patch" originally because the command generated a unified
diff that could be used as a patch file to apply to the repo.
|
|
This works now, thanks to 3c6f337e26964077d1ce629fa17d16e4484b877f.
|
|
This function is no longer calling the `git diff` command, so this name
doesn't make sense.
|
|
The diff command wasn't exiting after outputting the diff. Add the
`--no-pager` argument to ensure that the pager doesn't activate. This
also seems to cause the command to exit once all the output is printed.
We don't want the pager because we need to call `git diff` for each
suggestion. If an early diff took up more than a page and activated the
pager, that would block the next diffs from appearing. We want them all
to appear at once.
|
|
This reverts commit 588cd526fd78b3a0e0ec1dfb9fc194ca385de902.
Since each suggestion has its own associated commit, we can't compare a
tree and a single commit. We'll probably have to invoke `git diff` once
for each suggestion.
|
|
This will enable us to use the `git diff` command with more than one
suggestion at the same time.
We compare the commit of the suggestion with the new index's tree.
And as I write this, I'm realising that we can't diff multiple
suggestions using the same commit because each suggestion has its own
commit.
Need to work out a different way to do this.
|
|
Don't run the `git diff` command in this function, instead return the
new blob created for the right hand side of the comparison.
This will facilitate showing the diffs of multiple suggestions at once.
Maybe. I haven't tried the command yet.
Actually, looking at the man page, it doesn't say we can include more
than one blob pair, so I might need to put all of the suggestion changes
into a single blob and compare the original commit with that.
|
|
I want to enable colour diff output. At first, I thought about doing
this by getting the diff colours from the Git config, then outputting
the ANSI escape codes manually with the text.
However, I then thought it would be nice to enable other diff features
like `--word-diff`, and it would be too much trouble to re-implement
that manually, and then I'd have to take word diff colouring into
account.
Decided that the optimal way to get both colours and extra diff
features like word diffing would be to use `git diff` directly under the
hood.
We shell out to `git diff`, and give it the original file as a base, and
a new blob object that we create in the repository on the right side.
This allows us to compare the file using a command in the following
format:
$ git diff <BASE>:src/server.rs <TEMPORARY_HASH>
Ostensibly, the temporary blob object I create for the right side
version should be freed automatically by `git2`.
Add a new `sugdiff` command to output diffs. This will replace
`sugpatch`. Since we're working with diffs, I think a name with "diff"
sounds more logical. The previous version, "patch" sounds too much like
what "apply" does, because of the Unix `patch` command.
|