Age | Commit message (Collapse) | Author |
|
I recently tried installing the program via Homebrew on a machine that
didn't have 'libgit2' installed. The Homebrew formula installs pre-built
binaries. Running the binaries gave me an error saying that the
'libgit2' dynamic library couldn't be found.
Change the build configuration to build a "static" binary. It still
links to system dylibs, but I've removed all links to Homebrew dylibs.
These were:
* libgit2
* openssl
Removed the 'openssl' link by adding the 'vendored-openssl' feature to
the 'git2' dependency.
In order to remove the 'libgit2' link, I had to do some more finagling.
Accomplished this by setting an empty `PKG_CONFIG_LIBDIR` when building.
While 'git2' doesn't have a Cargo feature to disable dynamic linking, we
can force static linking by preventing `pkg-config` from finding the
Homebrew-installed 'libgit2'. The 'libgit2-sys' crate's build script
first checks for the library using `pkg-config`, and builds it
statically if it doesn't exist:
https://github.com/rust-lang/git2-rs/blob/43d583fd8b50fad0cfe0bbc334059ce965b6f3fc/libgit2-sys/build.rs#L15-L17
With these changes, the above packages will now be statically linked
with the program's binaries.
Upgrade 'git2' to the latest version (0.13.11) since we're changing its
build configuration.
Before:
$ otool -L target/release/git-sug*
target/release/git-sugapply:
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57740.60.18)
/usr/local/opt/libgit2/lib/libgit2.1.0.dylib (compatibility version 1.0.0, current version 1.0.1)
/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
/usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
target/release/git-sugapply.d: is not an object file
target/release/git-sugdiff:
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57740.60.18)
/usr/local/opt/libgit2/lib/libgit2.1.0.dylib (compatibility version 1.0.0, current version 1.0.1)
/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
/usr/local/opt/openssl@1.1/lib/libcrypto.1.1.dylib (compatibility version 1.1.0, current version 1.1.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
target/release/git-sugdiff.d: is not an object file
After:
$ otool -L target/release/git-sug*
target/release/git-sugapply:
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57740.60.18)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1349.8.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
target/release/git-sugapply.d: is not an object file
target/release/git-sugdiff:
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 57740.60.18)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1349.8.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
/usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)
target/release/git-sugdiff.d: is not an object file
|
|
|
|
This function is no longer calling the `git diff` command, so this name
doesn't make sense.
|
|
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.
|
|
|
|
This is subsumed into `Cargo.lock` and doesn't do anything any more.
|
|
Since this is a Git command, this makes more sense to me.
|
|
Forgot to include this so we didn't get extra information about the
cause of the error.
|
|
|
|
Light documentation for our various functions and types.
|
|
Keep the binaries in the root crate, and add a new crate for the
`github-suggestion` library.
I want to add some library code to the CLI programs to extract common
functionality between the different binaries.
|