-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: include 0.6.0 features in documentation (#114)
- Loading branch information
1 parent
2646adb
commit 9a3315f
Showing
12 changed files
with
262 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
--- | ||
icon: material/clipboard-check-outline | ||
status: new | ||
title: Git checks and how to use them | ||
description: A series of inbuilt check for inspecting the environment and current repository | ||
--- | ||
|
@@ -32,7 +33,7 @@ func main() { | |
} | ||
``` | ||
|
||
## Checking the integrity of a Repository | ||
## Checking the integrity of a Repository :material-new-box:{.new-feature title="Feature added on the 26th of July 2023"} | ||
|
||
Check the integrity of a repository by running a series of tests and capturing the results for inspection. | ||
|
||
|
@@ -55,15 +56,21 @@ func main() { | |
} | ||
|
||
fmt.Printf("Default Branch: %s\n", repo.DefaultBranch) | ||
fmt.Printf("Shallow Clone: %t\n", repo.ShallowClone) | ||
fmt.Printf("Detached Head: %t\n", repo.DetachedHead) | ||
fmt.Printf("Origin: %s\n", repo.Origin) | ||
fmt.Printf("Remotes: %#v\n", repo.Remotes) | ||
fmt.Printf("Root Directory: %s\n", repo.RootDir) | ||
fmt.Printf("Shallow Clone: %t\n", repo.ShallowClone) | ||
} | ||
``` | ||
|
||
Example output when checking the integrity of a repository cloned within a CI system: | ||
|
||
```{ .text .no-select .no-copy } | ||
Default Branch: main | ||
Shallow Clone: false | ||
Detached Head: true | ||
Origin: [email protected]:purpleclay/gitz.git | ||
Remotes: map[string]string{"origin":"[email protected]:purpleclay/gitz.git"} | ||
Root Directory: /dev/github.com/purpleclay/gitz | ||
Shallow Clone: false | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
--- | ||
icon: material/text-search | ||
status: new | ||
title: Inspect an object within a repository | ||
description: Retrieve details about a specific object from within a repository | ||
--- | ||
|
||
# Inspect an object within a repository | ||
|
||
[:simple-git:{ .git-icon } Git Documentation](https://git-scm.com/docs/git-show) | ||
|
||
Retrieve detailed information about an object within a repository by its unique reference. | ||
|
||
## Inspect a tag | ||
|
||
Detailed information about a tag, and its associated commit, can be retrieved from a repository by passing its reference to `ShowTags`. The GPG signature of the commit is also retrieved if present. | ||
|
||
```{ .go .select linenums="1" } | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
git "github.com/purpleclay/gitz" | ||
) | ||
|
||
func main() { | ||
client, _ := git.NewClient() | ||
|
||
// Querying a tag from the gpg-import project | ||
|
||
tags, _ := client.ShowTags("0.3.2") | ||
|
||
tag := tags[0] | ||
if tag.Annotation != nil { | ||
fmt.Printf("Tagger: %s <%s>\n", | ||
tag.Annotation.Tagger.Name, tag.Annotation.Tagger.Email) | ||
fmt.Printf("TaggerDate: %s\n", | ||
tag.Annotation.TaggerDate.Format(time.RubyDate)) | ||
fmt.Printf("Message: %s\n\n", tag.Annotation.Message) | ||
} | ||
|
||
fmt.Printf("Author: %s <%s>\n", | ||
tag.Commit.Author.Name, tag.Commit.Author.Email) | ||
fmt.Printf("AuthorDate: %s\n", | ||
tag.Commit.AuthorDate.Format(time.RubyDate)) | ||
fmt.Printf("Commit: %s <%s>\n", | ||
tag.Commit.Committer.Name, tag.Commit.Committer.Email) | ||
fmt.Printf("CommitDate: %s\n", | ||
tag.Commit.CommitterDate.Format(time.RubyDate)) | ||
fmt.Printf("Message: %s\n\n", tag.Commit.Message) | ||
if tag.Commit.Signature != nil { | ||
fmt.Printf("Fingerprint: %s\n", tag.Commit.Signature.Fingerprint) | ||
} | ||
} | ||
``` | ||
|
||
```{ .text .no-select .no-copy } | ||
Tagger: purpleclay <[email protected]> | ||
TaggerDate: Thu Jun 29 07:05:18 +0100 2023 | ||
Message: chore: tagged for release 0.3.2 | ||
Author: Purple Clay <[email protected]> | ||
AuthorDate: Thu Jun 29 06:40:51 +0100 2023 | ||
Commit: GitHub <[email protected]> | ||
CommitDate: Thu Jun 29 06:40:51 +0100 2023 | ||
Message: fix: imported gpg key fails to sign when no tty is present (#33) | ||
Fingerprint: 4AEE18********** | ||
``` | ||
|
||
## Inspect a commit | ||
|
||
Retrieve information about a specific commit by passing its reference to `ShowCommits`. Including its GPG signature, if present. | ||
|
||
## Inspect a tree | ||
|
||
Call `ShowTrees` to retrieve a listing of all files and directories within a specific tree index of a repository. | ||
|
||
```{ .go .select linenums="1" } | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
git "github.com/purpleclay/gitz" | ||
) | ||
|
||
func main() { | ||
client, _ := git.NewClient() | ||
|
||
// Query the gittest directory tree within gitz | ||
|
||
tree, _ := client.ShowTrees("ad4a68f6628ba9a6c367fe213eb8136fdb95ebcd") | ||
for _, entry := range tree[0].Entries { | ||
fmt.Printf("%s\n", entry) | ||
} | ||
} | ||
``` | ||
|
||
```{ .text .no-select .no-copy } | ||
log.go | ||
log_test.go | ||
repository.go | ||
repository_test.go | ||
``` | ||
|
||
## Inspect a blob | ||
|
||
Retrieve the contents of a file (blob) from a repository by passing its reference to `ShowBlobs`. |
Oops, something went wrong.