<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git-suggestion/src/bin, branch v0.2.1</title>
<subtitle>Diffs and patches for GitHub pull request suggestions</subtitle>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/'/>
<entry>
<title>git-suggestion-cli: Rename crate to `git-suggestion`</title>
<updated>2020-08-30T02:51:51+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-30T02:51:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=4477ae635ec67d2b79ac670bbd73b88d4979e786'/>
<id>4477ae635ec67d2b79ac670bbd73b88d4979e786</id>
<content type='text'>
Now that I'm using the name "git-suggestion" in a few places, and from a
user perspective, it's more Git-oriented than GitHub-oriented, I think
the crate should be renamed to reflect that.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that I'm using the name "git-suggestion" in a few places, and from a
user perspective, it's more Git-oriented than GitHub-oriented, I think
the crate should be renamed to reflect that.
</pre>
</div>
</content>
</entry>
<entry>
<title>diff_options: Clean up code</title>
<updated>2020-08-29T23:20:33+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-29T23:20:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=905594dc8393f97c1a960d639af46175b3e6b76f'/>
<id>905594dc8393f97c1a960d639af46175b3e6b76f</id>
<content type='text'>
Remove old process code and comments.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove old process code and comments.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-sugdiff: Fix output by waiting for child process</title>
<updated>2020-08-29T20:58:33+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-29T20:58:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=b9729227347e0532891321548b31579b80376bdd'/>
<id>b9729227347e0532891321548b31579b80376bdd</id>
<content type='text'>
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(&amp;mut raw_request.stdout())
                        },
                        Error::ConduitResponse { .. } =&gt; {
                            error!("Error [-getting-]{+from+} response: {}", e);

                            internal_server_error(&amp;mut raw_request.stdout())
                        },

Turns out I need to wait for the command to exit in order to properly
execute the external command.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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(&amp;mut raw_request.stdout())
                        },
                        Error::ConduitResponse { .. } =&gt; {
                            error!("Error [-getting-]{+from+} response: {}", e);

                            internal_server_error(&amp;mut raw_request.stdout())
                        },

Turns out I need to wait for the command to exit in order to properly
execute the external command.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-sugdiff: Use `diff_options.parse()` to extract diff options</title>
<updated>2020-08-29T17:33:19+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-29T13:07:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=8706dc07bcf3b4c965de8e9dd050bd8b97ebc693'/>
<id>8706dc07bcf3b4c965de8e9dd050bd8b97ebc693</id>
<content type='text'>
Config::get():
Change `args` type so we can pass both a `Vec&lt;String&gt;` and
`Vec&lt;&amp;String&gt;`.

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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Config::get():
Change `args` type so we can pass both a `Vec&lt;String&gt;` and
`Vec&lt;&amp;String&gt;`.

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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add `diff_options` to parse Git diff options</title>
<updated>2020-08-26T19:41:36+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-26T19:41:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=f8aa7f6c8a632546b4cb234abf0030a39be52eed'/>
<id>f8aa7f6c8a632546b4cb234abf0030a39be52eed</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-sugdiff: Replace `unwrap`s with proper error handling</title>
<updated>2020-08-23T19:18:55+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-23T19:18:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=5432161bb1ba6414162a8c953d5ea36ea8ca022b'/>
<id>5432161bb1ba6414162a8c953d5ea36ea8ca022b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename `git-sugpatch` to `git-sugdiff`</title>
<updated>2020-08-23T18:55:08+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-23T18:55:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=623f60844478a3cfc60d697f5e5d804254c01c50'/>
<id>623f60844478a3cfc60d697f5e5d804254c01c50</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-sugdiff: Remove TODO</title>
<updated>2020-08-23T18:41:11+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-23T18:41:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=bce2e554408404233b66f11e2e342d83c3ca81dd'/>
<id>bce2e554408404233b66f11e2e342d83c3ca81dd</id>
<content type='text'>
This works now, thanks to 3c6f337e26964077d1ce629fa17d16e4484b877f.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This works now, thanks to 3c6f337e26964077d1ce629fa17d16e4484b877f.
</pre>
</div>
</content>
</entry>
<entry>
<title>Suggestion: Rename `diff_command()` to `blob()`</title>
<updated>2020-08-23T17:45:28+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-23T17:45:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=7028b38ba6ada33975ea44521ec121367c9d15f9'/>
<id>7028b38ba6ada33975ea44521ec121367c9d15f9</id>
<content type='text'>
This function is no longer calling the `git diff` command, so this name
doesn't make sense.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This function is no longer calling the `git diff` command, so this name
doesn't make sense.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-sugdiff: Add `--no-pager` to `git diff` command</title>
<updated>2020-08-23T16:38:34+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2020-08-23T16:38:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/git-suggestion/commit/?id=76079daf1e2175d02c9c584e47a21650fce30bb6'/>
<id>76079daf1e2175d02c9c584e47a21650fce30bb6</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
</feed>
